Skip to content

Instantly share code, notes, and snippets.

@artem-bez
Created February 2, 2017 15:57
Show Gist options
  • Save artem-bez/81d2264e6c6e07aa28647fdaa6f2dbf9 to your computer and use it in GitHub Desktop.
Save artem-bez/81d2264e6c6e07aa28647fdaa6f2dbf9 to your computer and use it in GitHub Desktop.
curl and httpie send body on DELETE request
~/% curl --version
curl 7.51.0 (x86_64-apple-darwin16.0) libcurl/7.51.0 SecureTransport zlib/1.2.8
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz UnixSockets
~/% curl -vvv -X DELETE -d '{ "some": "json" }' http://httpbin.org/delete
* Trying 23.22.14.18...
* TCP_NODELAY set
* Connected to httpbin.org (23.22.14.18) port 80 (#0)
> DELETE /delete HTTP/1.1
> Host: httpbin.org
> User-Agent: curl/7.51.0
> Accept: */*
> Content-Length: 18
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 18 out of 18 bytes
< HTTP/1.1 200 OK
< Server: nginx
< Date: Thu, 02 Feb 2017 15:53:05 GMT
< Content-Type: application/json
< Content-Length: 376
< Connection: keep-alive
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Credentials: true
<
{
"args": {},
"data": "",
"files": {},
"form": {
"{ \"some\": \"json\" }": ""
},
"headers": {
"Accept": "*/*",
"Content-Length": "18",
"Content-Type": "application/x-www-form-urlencoded",
"Host": "httpbin.org",
"User-Agent": "curl/7.51.0"
},
"json": null,
"origin": "81.170.208.242",
"url": "http://httpbin.org/delete"
}
* Curl_http_done: called premature == 0
* Connection #0 to host httpbin.org left intact
~/% http --version
0.9.8
~/% http -v DELETE http://httpbin.org/delete some=json
DELETE /delete HTTP/1.1
Accept: application/json, */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 16
Content-Type: application/json
Host: httpbin.org
User-Agent: HTTPie/0.9.8
{
"some": "json"
}
HTTP/1.1 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 423
Content-Type: application/json
Date: Thu, 02 Feb 2017 15:55:22 GMT
Server: nginx
{
"args": {},
"data": "{\"some\": \"json\"}",
"files": {},
"form": {},
"headers": {
"Accept": "application/json, */*",
"Accept-Encoding": "gzip, deflate",
"Content-Length": "16",
"Content-Type": "application/json",
"Host": "httpbin.org",
"User-Agent": "HTTPie/0.9.8"
},
"json": {
"some": "json"
},
"origin": "81.170.208.242",
"url": "http://httpbin.org/delete"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment