-
-
Notifications
You must be signed in to change notification settings - Fork 346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add color to request and response body when content-type is json #930
Conversation
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
library/src/main/kotlin/com/chuckerteam/chucker/internal/support/SpanTextUtil.kt
Outdated
Show resolved
Hide resolved
library/src/main/kotlin/com/chuckerteam/chucker/internal/support/SpanTextUtil.kt
Outdated
Show resolved
Hide resolved
library/src/main/kotlin/com/chuckerteam/chucker/internal/support/SpanTextUtil.kt
Outdated
Show resolved
Hide resolved
Thanks for your time @ArjanSM. I will fix them as soon as possible. |
Ok I removed my changes that fix the mentioned bug, and I will create another PR for them. |
@cortinico @ArjanSM kindly reminder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry for the delay. Just a few to nits to begin with. I'll give it a more thorough pass later in the week.
library/src/androidTest/kotlin/com/chuckerteam/chucker/SpanUtilTest.kt
Outdated
Show resolved
Hide resolved
...src/main/kotlin/com/chuckerteam/chucker/internal/ui/transaction/TransactionPayloadAdapter.kt
Outdated
Show resolved
Hide resolved
...src/main/kotlin/com/chuckerteam/chucker/internal/ui/transaction/TransactionPayloadAdapter.kt
Outdated
Show resolved
Hide resolved
...src/main/kotlin/com/chuckerteam/chucker/internal/ui/transaction/TransactionPayloadAdapter.kt
Outdated
Show resolved
Hide resolved
...rc/main/kotlin/com/chuckerteam/chucker/internal/ui/transaction/TransactionPayloadFragment.kt
Outdated
Show resolved
Hide resolved
...rc/main/kotlin/com/chuckerteam/chucker/internal/ui/transaction/TransactionPayloadFragment.kt
Outdated
Show resolved
Hide resolved
Hi @ArjanSM, Hope you are doing well. I resolved all threads you created.Please let me know if you have any other comment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting there!
Just a bunch of few nits.
library/src/main/kotlin/com/chuckerteam/chucker/internal/support/SpanTextUtil.kt
Outdated
Show resolved
Hide resolved
library/src/main/kotlin/com/chuckerteam/chucker/internal/support/SpanTextUtil.kt
Outdated
Show resolved
Hide resolved
library/src/main/kotlin/com/chuckerteam/chucker/internal/support/SpanTextUtil.kt
Outdated
Show resolved
Hide resolved
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? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good to me 👍 @ArjanSM already did a great review!
Only left a minor nits.
library/src/main/kotlin/com/chuckerteam/chucker/internal/support/SpanTextUtil.kt
Outdated
Show resolved
Hide resolved
library/src/main/kotlin/com/chuckerteam/chucker/internal/support/SpanTextUtil.kt
Outdated
Show resolved
Hide resolved
if (result.isEmpty()) | ||
result.add(subSequence(0, length)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's because when the char sequence doesn't have any lines so I should add all of its content to the result.
Aah! my bad! 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome @Amirhy Thanks for taking the time to add this feature!
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