0

I cannot for the life of me figure out how to append the headers to my get request.

    var session = new Soup.Session ();
    
    var msg = new Soup.Message (
      "GET", 
      "some-api-key"
    );

    session.send_message (msg);

    print ("Message: %s", (string) msg.response_body.data);

I can't find any examples for how to do this. It's a miracle I made it this far.

1 Answer 1

0

msg.request_headers.append ("Content-Type", "application/json");

2
  • It is the right answer, but it's also nice to include some resources, where OP can find more details, like valadoc MessageHeaders.
    – Vlad
    Jul 31, 2020 at 8:47
  • Thanks for this, sorry I answered my own question. I should have linked to some resources.
    – Brendan
    Jul 31, 2020 at 15:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.