HTTP delete method + posted variables

4 views
Skip to first unread message

gotwalt

unread,
Nov 5, 2009, 5:52:08 PM11/5/09
to Grackle Development
Heads-up from implementing lists - Net::HTTP::Delete returns false for
request_body_permitted? even though the http spec is unclear. Twitter
specifically requires an ID parameter posted in order to remove
members from the list. Below is the patch that we arrived at, which
may not be fully correct, but has yet to trigger an actual bug.

--- a/grackle-0.1.6/lib/grackle/transport.rb
+++ b/grackle-0.1.6/lib/grackle/transport.rb
@@ -119,9 +119,7 @@ module Grackle
end

def add_form_data(req,params)
- if req.request_body_permitted? && params
- req.set_form_data(params)
- end
+ req.set_form_data(params) if params
end

Hayes Davis

unread,
Nov 6, 2009, 10:11:46 AM11/6/09
to grac...@googlegroups.com
Thanks for finding this Aaron.

That change will end up calling set_form_data on GET requests too unless the params are removed from the options hash in Transport#request for GETs before calling execute_request. I'm not sure if that matters but I'll look into it and merge some form of this into master.

For what it's worth, my reading of the HTTP spec says Twitter shouldn't be doing it this way:
RFC2616, 9.7: "The DELETE method requests that the origin server delete the resource identified by the Request-URI"
Seems to me the id of the user should be part of the URI. Maybe I'll take that up with Twitter.

Hayes
Reply all
Reply to author
Forward
0 new messages