Skip to content

Fix FormUtils.isFormPostRequest to handle content-type with parameters#2968

Open
gnodet wants to merge 1 commit intomainfrom
fix/form-post-content-type-matching
Open

Fix FormUtils.isFormPostRequest to handle content-type with parameters#2968
gnodet wants to merge 1 commit intomainfrom
fix/form-post-content-type-matching

Conversation

@gnodet
Copy link
Contributor

@gnodet gnodet commented Mar 13, 2026

Summary

FormUtils.isFormPostRequest() uses equals() to match the content type, but in practice the Content-Type header can include parameters like application/x-www-form-urlencoded; charset=UTF-8.

This is extremely common — jQuery's $.ajax() sends exactly this content type by default. With the current code, form POST data is silently not recognized for these requests.

The fix uses startsWith instead of equals, consistent with how FormEncodingProvider already handles content types with charset parameters (see FormEncodingProviderTest lines 264 and 283).

Split out from #2955 per review feedback.

Test plan

  • rt/frontend/jaxrs module compiles and tests pass

🤖 Generated with Claude Code

Use startsWith instead of equals to match the content type, so that
requests with parameters like "application/x-www-form-urlencoded;
charset=UTF-8" (sent by jQuery $.ajax by default) are correctly
recognized as form POST requests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant