[drakma-devel] HTTP Put and form-data
Ben Holm
benbelly at gmail.com
Sun Nov 13 21:54:44 UTC 2011
Hi all. I started using drakma the other day to do some client work with
reviewboard, and I had a little trouble. Reviewboard requires http puts
using form-data for updates (
http://www.reviewboard.org/docs/manual/1.6/webapi/2.0/overview/). Drakma
explicitly disallows this.
I modified request.lisp to let my client do what I needed. Since this is my
first time writing a webservice client, I'm not sure if reviewboard or
drakma is wrong, or if I misunderstood something. Below is the diff of what
I did.
Any thoughts?
Thanks,
-Ben
Index: request.lisp
===================================================================
--- request.lisp (revision 4683)
+++ request.lisp (working copy)
@@ -410,7 +410,7 @@
(parameter-error "Don't know how to handle scheme ~S." (uri-scheme
uri)))
(when (and close keep-alive)
(parameter-error "CLOSE and KEEP-ALIVE must not be both true."))
- (when (and form-data (not (eq method :post)))
+ (when (and form-data (and (not (eq method :put)) (not (eq method
:post))))
(parameter-error "FORM-DATA makes only sense with POST requests."))
(when range
(unless (and (listp range)
@@ -432,7 +432,7 @@
(when (and file-parameters-p (not (eq method :post)))
(parameter-error "Don't know how to handle parameters in ~S, as this
is not a POST request."
parameters))
- (when (eq method :post)
+ (when (or (eq method :put) (eq method :post))
;; create content body for POST unless it was provided
(unless content
;; mark PARAMETERS argument as used up, so we don't use it
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/drakma-devel/attachments/20111113/a4b870b3/attachment.html>
More information about the Drakma-devel
mailing list