This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch fix/form-post-content-type-matching
in repository https://gitbox.apache.org/repos/asf/cxf.git

commit eb1b30c81594bb1fc52dcb251ad3e17a07c14c6d
Author: Guillaume Nodet <[email protected]>
AuthorDate: Fri Mar 13 11:42:07 2026 +0100

    Fix FormUtils.isFormPostRequest to handle content-type with parameters
    
    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 <[email protected]>
---
 .../jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java     | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java 
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
index f8443785baa..63dfd24f50f 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/FormUtils.java
@@ -306,7 +306,9 @@ public final class FormUtils {
     }
 
     public static boolean isFormPostRequest(Message m) {
-        return 
MediaType.APPLICATION_FORM_URLENCODED.equals(m.get(Message.CONTENT_TYPE))
+        String contentType = (String) m.get(Message.CONTENT_TYPE);
+        return contentType != null
+            && contentType.startsWith(MediaType.APPLICATION_FORM_URLENCODED)
             && HttpMethod.POST.equals(m.get(Message.HTTP_REQUEST_METHOD));
     }
 }

Reply via email to