Im having trouble sending POST requests with Gnome's libsoup. GET requests I can do just fine I just am unsure how to get a working post request.
_httpSession = new Soup.Session();
let url = "http://localhost:3000/api/auth/register/org";
var body = {body:"?how to add"}
let message = Soup.Message.new('POST', url);
message.set_request('application/json', 2,body);
_httpSession.queue_message(message, function (_httpSession, message){
//log res
global.log(message.response_body.data)
});
This is what I have right now. I don't know how to add the body of post request. The documentation says set_request requires 4 params but I get an error saying it expects 3 if I add the body.length.
Regarding the differing number of parameters, check if the documentation matches the used
Soup
-version:Regarding the adding of the payload to your message, the string has to be transformed into a byte array (see here):