You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Found out the problem by reading the documentation ... xD
The default client is HttpClient which is a thin wrapper over java.net.HttpUrlConnnection. java.net.HttpUrlConnnection does not support a PATCH method. HttpClient converts PATCH requests to a POST request and adds a X-HTTP-Method-Override: PATCH header. While this is a semi-standard industry practice not all APIs are configured to accept this header by default.
To allow for reflectively forcing PATCH to the string value on JDK11+, one must add JVM command line arguments: --add-opens java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED
Somehow a PATCH request method is received as POST request method in the server:
Client Request:
2017-11-20 16:35:39 INFO Main:66 - "Body : {"status": "rejected"}"
"Headers : (5)"
Accept-Encoding : compress;q=0.5, gzip;q=1.0
Content-Type : application/json
Authorization : Basic ....
X-API-Version : v1
Accept : /
Server logs:
2017-11-20T16:35:39.81+0100 [RTR/0] OUT abit.apps.emea.vwapps.io - [2017-11-20T15:35:39.757+0000] "POST /data/feedback/11111-1111-111-1111-1111111 HTTP/1.1" 400 22 296 "-" "Java/1.8.0_131" "IP:PORT" "IP:PORT" x_forwarded_for:"someIP, someIP" x_forwarded_proto:"https" vcap_request_id:"someID" response_time:0.06272777 app_id:"someID" app_index:"1"
I'm totally lost about why is this happening, tried same thing with a GoLang framework and it worked fine.
The text was updated successfully, but these errors were encountered: