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.

Headers change from original case to all lowercase during cy.request()

See original GitHub issue

Current behavior:

I use the “Authorization” header to authenticate a request but when I post a html form in cypress it changes all the HTTP headers to lowercase, so “Authorization” becomes “authorization” which is refused at backend.

so this is my browser Image of browser this is cypress Image of cypress

Desired behavior:

I’d like the request headers to keep their capital letter because it causes issues😋

Steps to reproduce:

Make a small php file with a html form, and when submit print_r(getallheaders());

Versions

Cypress V3.1.2 NodeJS v8.11.4 Npm v6.4.1

I use Chrome v70.0.3538.110 on MacOS Mojave v10.14.1

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
mjhenkescommented, Jan 14, 2022

The http spec specifies that headers should be case insensitive, as such we’re closing this issue.

Each header field consists of a case-insensitive field name followed by a colon ("😊, optional leading whitespace, the field value, and optional trailing whitespace.

1reaction
jennifer-shehanecommented, Dec 13, 2018

Hey @Robpizza, the HTTP spec does define header fields as case insensitive - so servers should be case insensitive as well.

Each header field consists of a case-insensitive field name followed by a colon ("😊, optional leading whitespace, the field value, and optional trailing whitespace.

But, I understand that not all servers may choose to behave in this way. I don’t think it would be unreasonable to pass along the Header fields with the casings as they were originally requested, but as you said, I’m not sure how this is implemented.

Read more comments on GitHub >

github_iconTop Results From Across the Web

fetch() sends lower case header keys - Stack Overflow
When I look at the request in the Electron Newtork panel, the request headers are present but Authorization has become authorization . I...
Read more >
Headers are getting convert into lower case? | Layer7 API ...
I tried MESSAGE_ID and MESSAGE_TYPE which is being converted in lowercase as i log all request headers in API gateway.
Read more >
request - Cypress Documentation
cy.request() yields the response as an object literal containing properties such as: status; body; headers ...
Read more >
Request and response objects - Django documentation
A case insensitive, dict-like object that provides access to all HTTP-prefixed headers (plus Content-Length and Content-Type ) from the request.
Read more >
Configure custom rules language attributes - Google Cloud
A string-to-string map of the HTTP request headers. If a header contains multiple values, the value in this map would be a comma-separated...
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