Add color to request and response body when content-type is json#930
Conversation
…_colorful_body
at TransactionPayloadAdapter.kt
|
Thanks for sending this @Amirhy. I won't be able to review this till sometime next week as I'm a bit busy at the moment 👍 |
|
Hi @cortinico. Hope you 're doing well. |
Sorry I was quite busy this week. I'll have to look into this over the next weekend. |
@cortinico I've been a little occupied today. I'll take a look at it tomorrow. |
ArjanSM
left a comment
There was a problem hiding this comment.
Thanks for the PR @Amirhy 🏅
I've made a few suggestions.
Also, I personally feel that it would be nice if you could create different PRs (one for text coloring feature and the other for the Text highlighting bug) or the reference to the feature issue and the bug in the PR description.
Thanks for your time @ArjanSM. I will fix them as soon as possible. |
…_colorful_body
Ok I removed my changes that fix the mentioned bug, and I will create another PR for them. |
|
@cortinico @ArjanSM kindly reminder |
ArjanSM
left a comment
There was a problem hiding this comment.
sorry for the delay. Just a few to nits to begin with. I'll give it a more thorough pass later in the week.
Hi @ArjanSM, Hope you are doing well. I resolved all threads you created.Please let me know if you have any other comment. |
ArjanSM
left a comment
There was a problem hiding this comment.
Getting there!
Just a bunch of few nits.
|
Hi Dear @ArjanSM Do you have any new nits about my changes? ;-) I want you check this comment and let me know what is your opinion? |
| if (result.isEmpty()) | ||
| result.add(subSequence(0, length)) |
There was a problem hiding this comment.
That's because when the char sequence doesn't have any lines so I should add all of its content to the result.
…_colorful_body
Aah! my bad! 👍 |
|
hi @Amirhy , I think there's performance issue when we used this implementation in large json data. I just updated my chucker with this colored request/response, in some cases it took 2-3 secs to load my response, and if its super big it'll just stuck on loading state. Can u verify this issue on your side? |
|
Hi @misael-jonathan , |
|
Hi, I just sent the json to your email. Actually it is the same json you can find in LargeJson.kt in the sample app. Thanks @Amirhy |
📷 Screenshots
📄 Context
I have been using chucker for a long time. But the gray texts in the body of the requests and responses bothered me and my teammates's eyes and also made it difficult for us to read the texts properly.
So I decided to color the text of body of requests and responses.
Although I've only done it for application/json content-type and I'll support the rest of them soon.
I also fixed a bug that if there is no HeaderItem type inside the adapter items and you search for a text in the body of requests and responses, the text does not highlight properly.
📝 Changes
🚫 Breaking
🛠️ How to test
I just write some tests for json formatting in SpanUtilTest class that you can run them and also you can do functional testing.
⏱️ Next steps
Implement this feature for other content-types , for example application/xml