How to read http headers

I am trying to read the value of a specific header from an HTTP request and assign it to a page variable. Is this the correct way of doing that?

outputs["HTTP request"].resHeaders['header-name']


Yes this seems fine, did you try it? Another option to try would be outputs["HTTP request"].resHeaders.header_name

What I posted does not work. I’ll try what you mentioned.

[“HTTP request”].resHeaders.header_name does not work either.


I did some testing, and it seems like [“HTTP request”].resHeaders comes in a map object. So try using outputs["HTTP request"]['header-name']


I tried using outputs[“HTTP request”][‘header-name’] to assign the specific http request header to a page variable (text) and display it on the page but it is not showing anything.

Hmm strange! I have this exact setup and it works. Are you sure the HTTP Request is working and that the header you are trying to get really is in the response header?

Yes, I know for a fact that the http request is working and the header is present in the response (I can see both in the developer tools in the preview)

OK I see what’s going on. It works in the preview app but doesn’t work in the web app.

Hi All,

I found out on the docs, that the resHeaders is and Object and we can check the contents of Object using Keys and Values.

Function signature

KEYS(object: Object) => Array

VALUES(object: Object) => Array.

But i am still not getting any content. I need to get a specific header which needs to be passed to other pages.

Is there any way to do.

did you sort out this issues, I have same problems now .