You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by gn...@apache.org on 2026/03/13 10:42:21 UTC

(cxf) branch fix/form-post-content-type-matching created (now eb1b30c8159)

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

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


      at eb1b30c8159 Fix FormUtils.isFormPostRequest to handle content-type with parameters

This branch includes the following new commits:

     new eb1b30c8159 Fix FormUtils.isFormPostRequest to handle content-type with parameters

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(cxf) 01/01: Fix FormUtils.isFormPostRequest to handle content-type with parameters

Posted by gn...@apache.org.
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 <gn...@gmail.com>
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 <no...@anthropic.com>
---
 .../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));
     }
 }