rescu icon indicating copy to clipboard operation
rescu copied to clipboard

Invalid HTTP method: PATCH

Open andre77 opened this issue 8 months ago • 2 comments

Facing a problem, where a REST API has a "PATCH" method using the jakarta.ws.rs.PATCH annotation i can very well setup such a call, but it fails with

Exception in thread "main" java.net.ProtocolException: Invalid HTTP method: PATCH
	at java.base/java.net.HttpURLConnection.setRequestMethod(HttpURLConnection.java:491)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.setRequestMethod(HttpURLConnection.java:598)
	at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.setRequestMethod(HttpsURLConnectionImpl.java:343)
	at si.mazi.rescu.HttpTemplate.configureURLConnection(HttpTemplate.java:182)
	at si.mazi.rescu.HttpTemplate.send(HttpTemplate.java:123)
	at si.mazi.rescu.RestInvocationHandler.invokeHttp(RestInvocationHandler.java:152)
	at si.mazi.rescu.RestInvocationHandler.invoke(RestInvocationHandler.java:111)

with older java versions one could work around it with a pretty dirty trick: https://stackoverflow.com/questions/25163131/httpurlconnection-invalid-http-method-patch

but with the newer java versions (like ie 22.0.1) the workaround does not work any more

any idea how to bypass the problem?

andre77 avatar Jun 18 '24 11:06 andre77