question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How do I read a response’s headers?

See original GitHub issue

Is there a way to read the headers of a response, similar to the fetch(url).then(response => response.headers)?

If not, maybe we could add this under a __headers?: {} field on all response objects?

Huge fan of this lib, btw. I’d be happy to submit a PR for this!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:7
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
mskripcommented, Nov 29, 2021

@ferdikoomen Could you please provide a link to the spec that says that? I found this article in the OpenAPI 3.0 spec which explicitly says:

A response is defined by its HTTP status code and the data returned in the response body and/or headers.

(see and/or, not either/or)

Also I found this example in the spec with both headers and content defined in the response schema.

1reaction
Excodiburcommented, Jun 28, 2022

Was there ever any update on this topic? Is it by now possible to get response header and body at once?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Response.headers - Web APIs | MDN
The headers read-only property of the Response interface contains the Headers object associated with the response.
Read more >
Reading response headers with Fetch API - Stack Overflow
In response to a cross-origin request, add 'Access-Control-Expose-Headers': '*' ...
Read more >
How to read request or response headers with the HTTP Client
Use the GetHeader() and GetHeaders() methods from the response object to get a single header value or the full list of headers. This...
Read more >
View Response Headers - StackPath Help
View headers with browser development tools ... Within the page, right-click (for PC users) or command-click (Mac users) to view options, and then ......
Read more >
Getting Response Headers with the Javascript Fetch API
You can't directly access the headers on the response to a fetch call – you have to iterate through after using the entries()...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found