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

Restore correct Accept header for form submissions #142

Merged
merged 2 commits into from
Jan 29, 2021
Merged

Conversation

seanpdoyle
Copy link
Contributor

Closes #141.
Follows-up #52.


When creating the headers for a FetchRequest, provide the default
headers to the delegate by adding an argument to the
additionalHeadersForRequest signature so that delegates can
incorporate the current values if they choose to. They're passed as a
copy to prevent delegates from destructively acting upon them, with the
intention that delegates merge values into them.

Testing

Add a guard middleware to the test server to reject all requests that
don't specify an Accept header containing "text/html, application/xhtml+xml".

Next, guard Stream requests with a similar check for
"text/vnd.turbo-stream.html". Since those endpoints are behind the
guard middleware, they'll also require "text/html, application/xhtml+xml" as well.

Finally, replace the Stream functional test's explicit call to fetch
with a <form> element submitting with the same content.

seanpdoyle and others added 2 commits January 29, 2021 09:05
Closes #141.
Follows-up #52.

---

When creating the headers for a `FetchRequest`, provide the default
headers to the delegate by adding an argument to the
`additionalHeadersForRequest` signature so that delegates can
incorporate the current values if they choose to. They're passed as a
copy to prevent delegates from destructively acting upon them, with the
intention that delegates merge values _into_ them.

Testing
---

Add a guard middleware to the test server to reject _all_ requests that
don't specify an [Accept][] header containing `"text/html,
application/xhtml+xml"`.

Next, guard Stream requests with a similar check for
`"text/vnd.turbo-stream.html"`. Since those endpoints are behind the
guard middleware, they'll also require `"text/html,
application/xhtml+xml"` as well.

Finally, replace the Stream functional test's explicit call to `fetch`
with a `<form>` element submitting with the same content.

[Accept]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Accept in form submissions should include at least "text/html"
2 participants