-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
Is DELETE with a body supported? #426
Comments
Can you influence the crafter of this api to use POST instead of DELETE? I |
@adriancole unfortunately this is not an option. I'm hitting a "legacy" api which will be replaced in the near future... though not near enough to make this something I can wait on implementing 😦. |
Gotcha. One way to bridge the gap is to make a Client that rewrites the |
Do you know what HTTP client are you using? I can't reproduce this with |
@JakeWharton Hmm... I'm not sure. I haven't specified one, so whatever the default is. |
Are you on the JVM or Android? |
Android |
Ah, ok. The workaround for this is to include OkHttp's jar in your app. Since we can't change the implementation of the OS our only choice is to use a standalone HTTP client. You don't need to opt-in to using OkHttp once you add it, Retrofit will automatically find it and use it (since it's the best choice). Can you give that a try and see if it fixes your problem? |
I'll give that a go tomorrow and report back. Thanks for the quick responses, @JakeWharton and @adriancole |
I'm going to close under the anticipation that it works. Let us know, though. |
@JakeWharton, I added OkHttp with the following line in my gradle.build file:
and I still get the following error on the DELETE request.
Any ideas? Did I miss a step? |
Paste the full stack trace please. |
The app doesn't crash. It reaches the Response is What other info from that |
What version of Android? I'll try to repro after lunch.
|
Assuming it's this then DELETE does not allow a request body. |
Ugh. What does the RFC say about it?
|
Using Genymotion emulator 4.4.2 (Moto X model in case that's of relevance). I get the same error on a 4.2.2 device. |
The RFC is vague - you quoted it in the linked issue. Since it doesn't appear to be clear what the correct behavior is, OkHttp should probably support it. |
Yeah I just clicked around it on mobile so glad to know it wasn't just me
|
We're tracking this on OkHttp (linked above in GitHub) and it should make the impending 1.5 release in the next few days. |
Awesome! Thanks for the update. |
Quick work! looks like the related PR in OkHttp was closed/merged. @JakeWharton is there a slated date for the mentioned 1.5 release? |
Today. On Fri, Mar 7, 2014 at 12:53 PM, Greg Loesch notifications@github.comwrote:
|
That rocks. Thanks! |
I have an instance where I need to send a body with a DELETE. I came across this closed issue (#330) and added my own interface per @JakeWharton's suggestion.
When I use this method, I get the following error:
java.net.ProtocolException: DELETE does not support writing
My interface method looks like this:
Have I implemented something wrong, or is this an issue? Any help would be fantastic. Hoping I don't have to abandon Retrofit or use another API library for just one use case.
The text was updated successfully, but these errors were encountered: