Using REST API call with http request object

Hello !

Foe example i have following curl example tht useses token for authentification

curl --header "Authorization: X-Road-ApiKey token=c6804432-37f8-43e3-b3f1-b7bd0b1ac3b0" "" -k

it works as expected and returns:


I tried implement this curl functionality under red-node environment creating flow using the inject , change and http request node.and two debug nodes for debugging

under the change node i implemented following set rules

msg.method get
msg.headers Authorization: X-Road-ApiKey token=c6804432-37f8-43e3-b3f1-b7bd0b1ac3b0

and under http request

Method -set by msg.method -
URL http://
check the Enable secure (SSL/TLS) and unchecked the check box "Use key and certificates from local "

I connceted the nodes and deployed and runned them

dubug node that was conncted to change object displayed in debug window following:

_msgid: "a52fd5f2.3feeb8"
payload: 1623328045476
topic: ""
method: "get"
headers: "Authorization: X-Road-ApiKey token=c6804432-37f8-43e3-b3f1-b7bd0b1ac3b0"
url: < same url as above in change node>

This looked fine but other debug object connected to http request node displyed in debug window
_msgid: "a52fd5f2.3feeb8"
payload: object
topic: ""
method: "get"
headers: object
x-road-ui-correlation-id: "8ea4c7d547089572"
x-content-type-options: "nosniff"
x-xss-protection: "1; mode=block"
cache-control: "no-cache, no-store, max-age=0, must-revalidate"
pragma: "no-cache"
expires: "0"
strict-transport-security: "max-age=31536000 ; includeSubDomains"
x-frame-options: "DENY"
content-security-policy: "default-src 'none'"
content-type: "application/json"
transfer-encoding: "chunked"
date: "Thu, 10 Jun 2021 12:27:25 GMT"
connection: "close"
x-node-red-request-node: "383da789"
url: < same url as above in change node>
statusCode: 401
responseUrl: " < same url as above in change node>"
redirectList: array[0]

I looks like something went wrong.
I would be happy if some could help find what is wrong about this node-red flow

Try this in change node.
set - msg.headers.Authorization
to - X-Road-ApiKey token=c6804432-37f8-43e3-b3f1-b7bd0b1ac3b0

Clarfication the msg.header is already settted to "Authorization: X-Road-ApiKey token=c6804432-37f4-43e3-b3f1-b7bb0b1ac3b0"

As in the curl example
curl --header "Authorization: X-Road-ApiKey token=c6804432-37f8-43e3-b3f1-b7bd0b1ac3b0" "" -k
Sceen shot chang and http request objects

yes you set msg.headers
to "Authorization: X-Road-ApiKey token=c6804432-37f8-43e3-b3f1-b7bd0b1ac3b0"

but that's not what i said try setting msg.headers.Authorization to"X-Road-ApiKey token=c6804432-37f8-43e3-b3f1-b7bd0b1ac3b0"

one sets headers to a string (but headers should be an object)
the other set headers to an object containing one property Authorization

Thanks It worked