-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Support custom HTTP methods with bodies. #229
Comments
We should fix this. Limiting the permitted protocols doesn't add value. One catch is that the HTTP method impacts behavior in a number of places. Most notably, for custom protocols like PROPFIND we wouldn't support caching. We also wouldn't know whether the request should carry a body or not. |
Friends with #386 |
I wrote a test for this, but then discovered we need to know more about the method than just its name. There are rules around which methods have request and response bodies, and how they interact with the cache. I believe the spec may have something to say about extra methods. I'm going to punt on this for now and come back to it for the next release. |
I think the implementors of HttpURLConnection got it wrong here. Clearly the spec states "extension-method". While this is an optional feature for a Server, it doesn't leave any space for a client side provider to speculate on the server side... http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1
The list of methods allowed by a resource can be specified in an Allow header field (section 14.7). The return code of the response always notifies the client whether a method is currently allowed on a resource, since the set of allowed methods can change dynamically. An origin server SHOULD return the status code 405 (Method Not Allowed) if the method is known by the origin server but not allowed for the requested resource, and 501 (Not Implemented) if the method is unrecognized or not implemented by the origin server. The methods GET and HEAD MUST be supported by all general-purpose servers. All other methods are OPTIONAL; however, if the above methods are implemented, they MUST be implemented with the same semantics as those specified in section 9. |
Is there currently any way to use PROPFIND with okhttp? |
See also PR #1901. Please tell me if I can do further changes, tests, etc for this modification. |
Thanks. |
This would be very neat! Now I have to include Apache Http Components for this isolated little thing. :( |
Please allow things like PROPFIND with request body. It seems not correct to be strict about custom http methods. |
PROPFIND was added. Re-purposing this issue for arbitrary methods allowing bodies. These would obviously be forbidden from any cache interaction as no semantics can be known.
— @JakeWharton
Is it possible to add support for custom HTTP methods such as PROPFIND?I realize there is a limitation of sun's implementation of HttpUrlConnection, but maybe you have some idea how to work around that?
we use apache http client in our project at the moment mainly because it allows to define custom http method by extending HttpEntityEnclosingRequestBase.
we tried to switch to OkHttp, both core version with HttpUrlConnection and OkApacheClient version - they both throw ProtocolException (probably because both use HttpUrlConnection inside)
The text was updated successfully, but these errors were encountered: