HTTP post Content-Type header not working

I'm attempting to send an http post request to an API. I can send it successfully using online API tester but when I try it with Node-Red I get a 302 error. The one variable i've found that gets me the same error with the online tester is not setting the Content-Type to application/json.
When I set this in node red the returned payload has Content-Type text/html; charset=UTF-8
This is in my function node:

msg.headers = {
  'Authorization': 'Bearer', 
  "Content-Type" : "application/json"
}; = {
  "checkout_to_type": "location",
  "assigned_location": 1,
  "location_id": msg.location

return msg;

what happens if you change this to msg.payload = {

Yup that did it. Thank you very much.
Is it because the http node automatically takes the payload moves it to data?

It is because using msg.payload is what is documented in the help text for the node.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.