Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 type definitions for Request and Response #10724
base: master
Are you sure you want to change the base?
Add type definitions for Request and Response #10724
Changes from 14 commits
a310cef
5af1edd
61aebaf
893bdbb
cc16197
349080b
56249b1
24d3531
33d31b8
341f5e3
666b878
d087269
d7185f0
80b0be3
9603d68
7c2bf7f
e24726d
dc5011c
7b1f13b
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
some experimental headers whe really never use. Why are they int default? Why they are different case BTW?
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.
Default optional, only for autocomplete. These are the ones in chrome.
Dunno what to use them for on the server-side, so probably can be removed.
Are they in the way though?
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'm not sure that we need experimental headers in the default list. Most of them are not added automatically, and for some, like
Sec-CH-UA-Mobile
, I don’t even see the point in using them in XP.My suggestion is as follows: drop them. If a developer really needs them, they can always add them at their own risk.
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 removed the experimental ones and added autocompletion to the Sec-Fetch ones.
I also added Priority since both Chrome and Firefox sends it.
There are tons of headers:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers
https://en.wikipedia.org/wiki/List_of_HTTP_header_fields
Not really sure which ones should be part of DefaultRequestHeaders.
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 my implementation of
WebSocketEvent
. It uses a discriminated union based on thetype
to ensure the shape of the object.Just consider if this pattern might be right for you too?
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.
My first implementation was similar to that, because it was based on the data I was able to generate in real life. I just simplified after looking at the Java class behind it.