Extract headers from a GraphQL query

Describe the problem/error/question

I am using a GraphQL API that uses a /login endpoint that then returns the Token to use in subsequent requests in the response header. My question is, is there any way to extract header data from the response. I only see the body of the response, none of the raw request data.

My secondary question is, if getting the header is impossible, does anybody have some docs on how to send GraphQL requests via the HTTPRequest node? I’ve tried this as well and have got nowhere so far.

Update - I was actually able to get a raw HTTPRequest working for this and I don’t see a way to extract headers from this as well which makes me think I just don’t know where to look for this info.

Information on your n8n setup

  • n8n version: 1.x
  • Database (default: SQLite): Postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main): main
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Hosted n8n
  • Operating system: Linux

Hi @zenweasel, in order to see the response headers on the HTTP Request node you’d need to enable the “Include Response Headers” option under Options → Response, like so:

Hope this helps! Let me know if you run into any trouble with this.


Thanks, that did it. Am I right in assuming that the GraphQL node does not have the capability to return headers like the HTTP response does?

I’m afraid so, though the HTTP Request node can serve as a replacement in most cases.

Perhaps you want to open a new feature request for being able to (optionally) see HTTP response headers in the GraphQL node?

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