Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid HTTP method: PATCH #147

Open
andre77 opened this issue Jun 18, 2024 · 2 comments
Open

Invalid HTTP method: PATCH #147

andre77 opened this issue Jun 18, 2024 · 2 comments

Comments

@andre77
Copy link

andre77 commented Jun 18, 2024

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?

@mmazi
Copy link
Owner

mmazi commented Jun 19, 2024

See also #95, #97, #100.

@andre77
Copy link
Author

andre77 commented Jun 19, 2024

here is an idea
#148

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

No branches or pull requests

2 participants