curl-library
Re: Require help on performing HTTP GET/DELETE/PATCH with http body
Date: Thu, 8 Nov 2018 16:12:42 +0100 (CET)
On Thu, 8 Nov 2018, Badari Prasad wrote:
> This example works for HTTP GET provided CURLOPT_UPLOAD is set. Else body is
> not sent along with http get. My app does exactly the same as in example,
> uses easy handle for synchronous call.
curl treats the specific methods differently, so depending on what you start
out the request with you'll get slightly different behaviors.
Sending a GET with a body is unusual. A default GET request with curl doesn't
send any body. To change this, the easy way is to do a POST (with POSTFIELDS
or a callback) and change the method to "GET" with CURLOPT_CUSTOMREQUEST.
You'd do exactly the same thing to send a "DELETE" or "PATCH" with a body as
well.
> One difference I did notice is that Expect header was not being sent as part
> of headers in my app for http get/delete, I am using libcurl 7.59.0 version
> of libcurl.
curl sends Expect: according to some simple hueristics, and I'm pretty sure
that logic is unchanged since way before 7.59.0.
-- / daniel.haxx.se ------------------------------------------------------------------- Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.htmlReceived on 2018-11-08