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

Ensure fetch method is always uppercase #1169

Merged
merged 3 commits into from
Jul 13, 2024
Merged

Conversation

npezza93
Copy link
Contributor

@npezza93 npezza93 commented Feb 7, 2024

Fixes #1100

In 7.3 this was always upper cased but in v8 it is not. This breaks forms that use formmethod on buttons. On chrome and firefox puma returns a 400 but once the method is uppercased it works.

method: FetchMethod[this.method].toUpperCase(),

@npezza93
Copy link
Contributor Author

npezza93 commented Feb 9, 2024

@afcapel Are there flaky tests in the suite or are these legit failures?

@afcapel
Copy link
Collaborator

afcapel commented Feb 9, 2024

The autofocus tests are a bit flaky, see #1154

@npezza93
Copy link
Contributor Author

npezza93 commented Feb 9, 2024

On main, locally the loading_test tests is failing for me as well.

@rainerborene
Copy link

I am using this workaround until this PR gets merged.

document.addEventListener("turbo:before-fetch-request", ({ detail: { fetchOptions } }) => {
  fetchOptions.method = fetchOptions.method.toUpperCase()
})

@npezza93
Copy link
Contributor Author

@brunoprietog Finally figured out the issue with tests here. This is ready to go now

@brunoprietog
Copy link
Collaborator

Nice! Thanks @npezza93!

@brunoprietog brunoprietog merged commit 2a62bbf into hotwired:main Jul 13, 2024
1 check passed
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.

Turbo 8 Beta 1: Button with formmethod="patch" sends form method in lower case
4 participants