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.

Why should we do toLowerCase to header name (by normalizeName()) ?

See original GitHub issue

Code first:

fetch( url, {
    headers:{
        'Cookie':'some key-value pass to server',
        'User-Agent': 'react-native Android'
    }
);

I found that the name of headers has been converted to lower case by normalizeName .

And when I use it on React-Native (Android platform) , it send a HTTP request with lower case header name which not be recognized in our Server.

There is the row HTTP text I’ve capture:

GET http://... HTTP/1.1
cookie: ...
user-agent: react-native Android 

So. Why should we do toLowerCase to header name ?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:7
  • Comments:16 (2 by maintainers)

github_iconTop GitHub Comments

76reactions
amrdrazcommented, Jul 16, 2016

While Http headers should be case-insensitive, a server for a client we’re dealing with has miss implemented the spec. They check authorization header using equality it seems and accordingly produce an error.

We do not have control over modifying the code of that server, we can submit a request but that will take time to process.

If according to the spec the header should be case-insensitive I don’t see why forcing the headers to be lower case matters then, we should be generally allowed to send headers in any case form.

60reactions
mislavcommented, Oct 31, 2016

@kobvel That’s correct.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to prevent of converting header name into lower case
I am adding custom headers to my response and Spring boot doesn't convert headers to lowercase in my case. Have you checked response...
Read more >
com.liferay.portal.kernel.util.StringUtil.toLowerCase java code ...
Returns true if the strings are equal, ignoring case. trim. Trims leading and trailing whitespace from the string, up to but not including...
Read more >
Name normalization - Relativity Documentation
Name normalization analyzes email document headers to identify all aliases, such as proper names, email addresses, and more, and the entities, ...
Read more >
String.prototype.toLowerCase() - JavaScript - MDN Web Docs
The toLowerCase() method returns the value of the string converted to lower case. toLowerCase() does not affect the value of the string str ......
Read more >
falcon.response — Falcon 3.1.1 documentation
Note: Falcon will encode the given text as UTF-8 in the response. ... where we need more control over setting # headers and...
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