Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

DELETE request with Payload #98

Open
wants to merge 1 commit into from

7 participants

@actaneon

We are attempting to use RestClient to use the Chargify.com API. One of APIs has a DELETE request with a payload. We're not aware of anything in the spec that forbids a payload for a DELETE request so we have updated the gem to support this.

@archiloque
Owner

As it's rarely used I prefer to avoid breaking the API for it

@archiloque archiloque closed this
@kabturek

unfortunately it isn't that rare.
you can use RestClient::Request directly or use monkey patching
RestClient::Request.execute(:method => method, :url => url, :payload => payload, :headers => {})

@cjbottaro

Elasticsearch also has a API using a DELETE request with payload:
http://www.elasticsearch.org/guide/reference/api/delete-by-query/

+1 to add this functionality.

@L2G L2G reopened this
@L2G
Owner
L2G commented

I'm okay with doing this if it could be made backwards compatible. Then I think we could earmark it for 1.7.0.

@thefosk

+1, not implementing this is against the HTTP spec, as the spec doesn't forbid a body in a DELETE request.

@ab
Owner
ab commented

You're right that the delete method should probably accept a payload, but I don't think we can break API compatibility in a minor release. In the meantime you can use RestClient::Request.execute instead of one of the helpers.

See also #266

@ab ab added this to the 2.0.0 milestone
@ab ab referenced this pull request
Open

Payload Support For DELETE #266

@ab ab modified the milestone: 3.0, 2.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 1, 2011
  1. Added support for payload on DELETE request

    Josh King authored
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/restclient.rb
View
4 lib/restclient.rb
@@ -80,8 +80,8 @@ def self.put(url, payload, headers={}, &block)
Request.execute(:method => :put, :url => url, :payload => payload, :headers => headers, &block)
end
- def self.delete(url, headers={}, &block)
- Request.execute(:method => :delete, :url => url, :headers => headers, &block)
+ def self.delete(url, payload, headers={}, &block)
+ Request.execute(:method => :delete, :url => url, :payload => payload, :headers => headers, &block)
end
def self.head(url, headers={}, &block)
Something went wrong with that request. Please try again.