serf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Erenkrantz <jus...@erenkrantz.com>
Subject Re: example code POST with json body
Date Tue, 16 Mar 2021 20:30:25 GMT
Hi Andrew,

You can pass in the -f and -m options to serf_get to send a POST request -
eg:

% ./serf_get -m POST -f your.json

Take a look around setup_request (lines 347) and the options parsing around
lines 617:

https://github.com/apache/serf/blob/trunk/test/serf_get.c#L347
https://github.com/apache/serf/blob/trunk/test/serf_get.c#L617

If you have the JSON blob in memory rather than on disk, you can replace
the file bucket with a memory bucket, etc, etc.

Depending upon what is on the other end, you may also need to set request
headers as well indicating the content-type of the body.

Cheers.  -- justin

On Tue, Mar 16, 2021 at 6:20 AM andrew klassen <aptklassen@yahoo.com.invalid>
wrote:

> Sorry to bother you but I am not able to find example code for client side
> POSTrequest. Specifically, I need to send POST messages with a json body. I
> see severaluses of GET in the tests directory.
> Thank you for any help,Andrew
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message