Sending a Request Payload


#1

I am trying to do a POST to my server which is expecting a Request Payload in JSON format not Form Data.
I am try this

const ScopedPointer stream(url.withPOSTData("{id:1,name:‘aaa’}").createInputStream(true, nullptr, nullptr, “Content-Type: application/json”, 0, &responseHeaders, &statusCode, 5, “POST”));

The server returns a 400.
Am I doing something wrong or is there no way to send a Request Payload?


#2

I finally figured this out and it turns out to be pretty simple. The server wants double quotes so it thought the payload was binary data. I just needed to change the json to this
{“id”:1,“name”:“aaa”}