POST request with std.net.curl

bachmeier no at spam.net
Sun Jul 25 12:37:05 UTC 2021


On Saturday, 24 July 2021 at 06:01:25 UTC, frame wrote:
> On Friday, 23 July 2021 at 21:25:01 UTC, bachmeier wrote:
>
>> Authorization is working - it's the same whether I'm doing a 
>> GET or POST request. The problem is passing the data. The main 
>> problem is that the documentation doesn't explain how to 
>> translate a `--data` option into a `post` call. I've tried 
>> everything I can think of, including what's shown in the 
>> documentation, but haven't found anything that works.
>
> You just need to supply a JSON encoded string for the data - 
> from an object like std.json.JSONValue via its toString() 
> method for example.

I understand, and indeed, that's what's done by the working curl 
command I posted. I don't know how to translate that into a post 
request using std.net.curl. The natural thing would be to pass as 
the second argument the same string I'm sending as the `--data` 
option to curl, but that doesn't work.

I've decided to give up on std.net.curl and use executeShell to 
capture the output from shell commands.


More information about the Digitalmars-d-learn mailing list