gdi / curb-fu

Simple, yet powerful wrapper for taf2's curb (libcurl) library
Other
57 stars 9 forks source link

DELETE method doesn't allow extra params to be passed in #6

Closed BryanDonovan closed 13 years ago

BryanDonovan commented 13 years ago

I noticed the DELETE method doesn't allow extra params to be passed in. Maybe there's a good reason for this, but I've made the following change and it seems to work:

diff --git a/lib/curb-fu/request/base.rb b/lib/curb-fu/request/base.rb
index cc59c25..2cd3c09 100644
--- a/lib/curb-fu/request/base.rb
+++ b/lib/curb-fu/request/base.rb
@@ -82,8 +82,8 @@ module CurbFu
     CurbFu::Response::Base.from_curb_response(curb)
   end

-      def delete(url)
-        curb = self.build(url)
+      def delete(url, params = {})
+        curb = self.build(url, params)
         curb.http_delete
         CurbFu::Response::Base.from_curb_response(curb)
       end

I've forked the project with this patch here: https://github.com/bdondo/curb-fu

BryanDonovan commented 13 years ago

I guess my patch doesn't work after all.

gdi commented 13 years ago

Hey, I haven't really had any need to send additional parameters along with a DELETE request, so that's probably why it doesn't already do that :). I wonder if there is a limitation in the underlying curb library, because it seems like that patch should work. Send me a pull request with an associated test and I'd be happy to merge it.

BryanDonovan commented 13 years ago

Thanks. I'll get something together as soon as I can. I do believe there might be a limitation with curb. I didn't have time to investigate further so just switched (temporarily) to HTTParty.