-
-
Notifications
You must be signed in to change notification settings - Fork 441
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 HTTP headers parsing #297
base: master
Are you sure you want to change the base?
Conversation
http.go
Outdated
import ( | ||
"bufio" | ||
"bytes" | ||
"encoding/json" |
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.
And let's use our own parser jsonx
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.
I was using encoding/json
because I needed to manipulate JSON (mostly combine), not only parse. But I agree, having two separate parsers is a bit excessive.
I don't disagree, but this format rises questions:
I'd say the following will pose least problems:
So, effectively:
|
Yes.
I guess this will be just a key/value pair.
Wrapping and scrolling.
Yes. This is actually number one thing what is needed.
This is easy. |
cd90be3
to
e20de01
Compare
e20de01
to
eabbebb
Compare
This update is much more finished:
Re multiple documents support, I've tried that approach at first, but it requires too many changes in lots of places. So, instead I'm just adding some new nodes at the start to display headers (along with new |
Awesome! Let me review and test this PR before merging. |
Yay! But FYI, currently I have no idea what JavaScript part of the project does, so, this PR so far was about Go code only. |
This is far from the final implementation. More of a conversation starter.
Few notes:
http.ReadResponse
to properly parse headers.http.ReadResponse
because that's how it works.HTTP/2
(no minor version) is included.fx
is JSON viewer, so, we convert things to JSON and view them.Things to consider:
Content-Type
and other related headers are ignored. What if it's notapplication/json
, or not UTF-8? Or if it's YAML?http.ReadResponse
might be picky aboutContent-Length
header (especially wrong values). Just believe it will work fine? Make it ignore content length? Show some warning?http.ReadResponse
. Is this really important? Maybe users will want a CLI option (or hotkey) to switch modes?closes #290