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
Update formatting to make request/responses easier to read #66
Conversation
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.
Hi @colinhumber! Thanks for this PR. Everything sounds good, but I don't understand why you replaced the method inside the RequestModelBeautifier.
- Paolo
let jsonData = try? JSONSerialization.data(withJSONObject: object, options: [.prettyPrinted]), | ||
let formattedJSON = String(data: jsonData, encoding: .utf8) else { return nil } | ||
|
||
return formattedJSON.replacingOccurrences(of: "\\", with: "") |
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 a little bit weird... if a string contains \\
occurrences, you replace it. I'm not sure it's the best way to do it.
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.
Oh good call. I did this a little haphazardly 😬. Just pushed an update that correctly replaces escaped forward slashes (\\/
) with a normal slash (/
).
- use Courier font when displaying JSON content - use prettyPrinted option with JSONSerializer - remove escaped slashes to allow URLs to render correctly - add link detection to URLs in JSON payloads
The
I switched it to let the system do the pretty printing as the |
592cec1
to
18ad6c5
Compare
@pmusolino Btw thanks for all the work on this library! |
Thank you very much @colinhumber for clarifying this particular! |
No description provided.