cURL / Mailing Lists / curl-users / Single Mail

curl-users

HTTP DELETE - how to pass parameters

From: Erik Steffl <steffl_at_bigfoot.com>
Date: Tue, 19 May 2009 14:32:37 -0700

I am using curl to send HTTP DELETE request and I would like to add some
parameters to url and encode those parameters, however unlike --get the
data specified don't end up in URL but in a body instead.

When I specify --get and -X DELETE it works as I want it to, not sure if
that's intended or if it's a bug:

curl --globoff --get -XDELETE http://localhost/project/Resource
--data-urlencode message='some stuff here to filter resources'

This turns into:

"DELETE /project/Resource?message=fitler url encoded
HTTP/1.1\r\nUser-Agent: curl/7.18.2 (i486-pc-linux-gnu) libcurl/7.18.2
OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.10\r\nHost: localhost\r\nAccept:
*/*\r\n\r\n"

Which is exactly what I want.

However I expected this command to work (no --get, just -XDELETE):

curl --globoff -XDELETE http://localhost/project/Resource
--data-urlencode message='some stuff here to filter resources'

However this sends (data in the body instead of in URI):

"DELETE /project/Resource HTTP/1.1\r\nUser-Agent: curl/7.18.2
(i486-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.8g zlib/1.2.3.3
libidn/1.10\r\nHost: localhost\r\nAccept: */*\r\n\r\nmessage=fitler url
encoded"

Just curious how is this supposed to behave, as far as I can tell DELETE
should not have body so -X DELETE should behave just like --get.

        erik

-------------------------------------------------------------------
List admin: http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-05-19