Closed SemihCag closed 8 months ago
Hi @SemihCag, I see what you're trying to do here, but unfortunately the change you're proposing is not going to work.
delete
cannot be in both METHODS_WITH_QUERY
and METHODS_WITH_BODY
at the same time, as the latter would override the method definition of the former. This would also make the change backwards-incompatible, so I'm afraid I can't accept it.
The good news however is that you can already send bodies in your delete
requests 🎉 !
This is possible thanks to the block syntax:
conn.delete('/') do |req|
req.body = # ...
end
Please note that not all adapters support this feature, so you'll need to make sure you're using the right one as shown in this comparative table. At the moment, it seems like only the patron
adapter does not support it.
If you have any issues sending a body with your delete
requests, feel free to open an issue 👍
Thank you for your response. We are currently using it with the method you gave in your comment.
However, we did not have any problems with override in the suggestion I gave. We recommended this by testing.
I'm not saying the code will break after this change, but that the behaviour will change.
Today when someone calls conn.delete('/resources/123', {param: 'a'})
, that would turn into a DELETE /resources/123?param=a
request.
After this change, delete would be re-defined as a "method with body" and therefore the same method call would produce a DELETE /resources/123
request with param=a
body. This would potentially cause an unexpected change and break existing code functionality. I hope that helps clarifying 🙂
Thank you for your detailed explanation. 🙂
Description
We have the opportunity to send requests simply with both params and body.
Example
Body
@request.delete(@path, body = @msg)
Params
@request.delete(@path, params = @msg)
Todos
List any remaining work that needs to be done, i.e: