cURL / Mailing Lists / curl-library / Single Mail

curl-library

GET Requests with content payload

From: Pedro Cordeiro <pedronaroga_at_gmail.com>
Date: Wed, 11 Jun 2014 16:08:05 -0300

A lot of restful APIs have GET routes for resources that can be filtered
with XMLs/JSON objects in the request body.

Even though a content payload is not explicitly part of the specification
of the GET method, it is allowed, and some APIs use it.

cURL allows it:

$ curl -X GET http://dev.pedro.sicneo -d "teste" -v
[...]
> GET / HTTP/1.1
> User-Agent: curl/7.36.0
> Host: dev.pedro.sicneo
> Accept: */*
> Content-Length: 5
> Content-Type: application/x-www-form-urlencoded
* upload completely sent off: 5 out of 5 bytes*

I was wondering how to do this with libcurl. Someone replied on
stackoverflow this is not allowed (and I'm quite sure it is), and it seemed
inconsistent that I can do this with cURL but not with libcurl.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-06-11