-
Notifications
You must be signed in to change notification settings - Fork 362
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
Send a body on delete method #206
Comments
A body isn't specifically disallowed by the spec but also has no specced semantics. I'm not sure if we'd add one or not. What is the motivation? |
I would like to have the body in the DELETE method because people don't read the standard, and the standard is vague. OpenAPI Specification ver. 2 in swagger allows it. (At least in javascript and go) Its probably wrong but it works. |
+1 |
For reference, RFC 2616 doesn't mention much in connection with DELETE, but RFC 7231 has the following to say:
So while setting body on a DELETE request isn't strictly forbidden in the spec, it is discouraged. |
Is it really our job to decide whether users are allowed to do things discouraged by the spec? A HTTP library should be able to do anything allowed by the spec, whether it's discouraged or not. This is a missing feature. |
You can do this: var rq = Request('DELETE', Uri.parse(...));
rq.bodyFields = {...};
var response = await client.send(rq).then(Response.fromStream); It's not a "missing feature," IMO, because it's already supported. |
@thosakwe I am trying to implement your suggestion but it seems like I can not add headers parameters with that, is it possible? |
I did it, I paste the code if it helps someone (DELETE particular token from server)
|
Please add support for body parameter in http.delete method |
I feel this would be trivial to send in a PR for.
On Sun, May 12, 2019 at 2:58 PM devmvk ***@***.***> wrote:
Please add support for body parameter in http.delete method
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#206 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACMIUPF7L4MUFFSEAHACV3TPVBSEFANCNFSM4F2QRNPA>
.
--
--
*Tobe Osakwe*
Student, B.S. Comp. Sci, Florida State University
https://thosakwe.com
|
Use case: Deleting a resource does not necessarily mean it is actually being deleted. It may be being marked deleted in the database and may require a reason for the deletion. |
Ive also encountered badly designed API's which needs payloads in DELETE methods and had to implement some boilerplate to make this work. Would love to see an optional overridable method to feed a payload. |
Hi all, I've just found simple code to get call back value after delete with RESTful endpoint, still can't go with http.delete, but it can do RESTful delete as expected with id parameter on body. thanks to @quetool for the inspiration. Here's the code: `// Flutter code void deleteData() async { `// PHP RESTfull code function index_delete() // Delete |
The spec discourages but does not forbid a body. Allow a body argument without falling back on the `send` API since some servers may be designed specifically to require it. Closes dart-lang#383, closes dart-lang#206
how to get the body from response? |
@cv-irvan Look at the last line of my solution above. Basically, you use |
The method http.delete just accept url and headers, can you put a body parameter ?
The text was updated successfully, but these errors were encountered: