-
Notifications
You must be signed in to change notification settings - Fork 436
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
Form Encoding #128
Merged
Merged
Form Encoding #128
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
seanpdoyle
force-pushed
the
formenctype
branch
6 times, most recently
from
January 22, 2021 17:04
375ab5d
to
40c6455
Compare
seanpdoyle
commented
Jan 22, 2021
seanpdoyle
force-pushed
the
formenctype
branch
3 times, most recently
from
January 28, 2021 01:23
233311e
to
e2833b8
Compare
kaspth
reviewed
Jan 28, 2021
seanpdoyle
commented
Jan 28, 2021
seanpdoyle
force-pushed
the
formenctype
branch
from
January 28, 2021 04:03
68c4bd3
to
deb3aae
Compare
kaspth
reviewed
Jan 28, 2021
Closes hotwired#76 According to the HTML Specification for [Form Submission Encoding][], there are three possible values: * [application/x-www-form-urlencoded][] (the default value) * [multipart/form-data][] * [text/plain][] [Encoding declarations on `<form method="get">` elements are ignored][get-ignored]. This commit re-structures the `FetchRequest` constructor, and moves the FormData to URL parameter encoding process _out_ to the `FormSubmission` itself, since the `HTMLFormElement` knows about its [enctype][] and the submitter its [formenctype][]. We don't need to declare the `Content-Type` header, since `fetch` is capable of inferring that based on whether the body is a `FormData` instance of an instance of `URLSearchParams`. [Form Submission Encoding]: https://www.w3.org/TR/html52/sec-forms.html#selecting-a-form-submission-encoding [application/x-www-form-urlencoded]: https://www.w3.org/TR/html52/sec-forms.html#selecting-a-form-submission-encoding [multipart/form-data]: https://www.w3.org/TR/html52/sec-forms.html#multipart-form-data [text/plain]: https://www.w3.org/TR/html52/sec-forms.html#plain-text-form-data [enctype]: https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/enctype [formenctype]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-formenctype [get-ignored]: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest#submitting_forms_and_uploading_files
seanpdoyle
force-pushed
the
formenctype
branch
from
January 28, 2021 19:32
917f7d1
to
8225a20
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #76
According to the HTML Specification for Form Submission Encoding,
there are three possible values:
Encoding declarations on
<form method="get">
elements areignored.
This commit re-structures the
FetchRequest
constructor, and moves theFormData to URL parameter encoding process out to the
FormSubmission
itself, since the
HTMLFormElement
knows about its enctype and thesubmitter its formenctype.