Skip to content
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 colors to output #7

Merged
merged 2 commits into from
Jul 14, 2023
Merged

Add colors to output #7

merged 2 commits into from
Jul 14, 2023

Conversation

eboody
Copy link
Contributor

@eboody eboody commented Jun 21, 2023

Added some colors behind a feature flag color-output to make it easier for some people to scroll through long lists of request/response outputs.

Methods are colored: (GET, POST, PUSH, DELETE) = (Blue, Green, Yellow, Red)
Status codes (200-299, 300-399, 400-499, 500-599) = (Green, Blue, Yellow, Red)

If the response body is just text, the output will be the same color as the status code.
JSON response bodies will be colored based off the colored_json crate.

For brevity, the schema and host were stripped out of the URL (Please let me know if this is a bad idea!)

colored adds 21.6 kB
colored_json adds 13.6 kB
url adds 75.7 kB

considering im only using the url crate to extract the path it might be worth it to just do some string manipulation instead since its the biggest crate of the three by far even though the crates are behind the feature flag.

2023-06-21_16 22 21

@jeremychone
Copy link
Owner

Thanks, this is an awesome addition. I will look at it and merge it next week.

@eboody eboody changed the title added some colors to the output Add colors to output Jun 21, 2023
@jeremychone jeremychone merged commit 8f6ac00 into jeremychone:main Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants