Different versions of X-Ratelimit-Remaining header

When i do a request

curl -iks https://api.github.com/zen
i get

X-Ratelimit-Limit: 60
X-Ratelimit-Remaining: 58
X-Ratelimit-Reset: 1608514277
X-Ratelimit-Used: 2

The ratelimit headers all have a lower case L for limit.

When i run
curl -iks user:token https://api.github.com/zen
i get

X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4995
X-RateLimit-Reset: 1608513173
X-RateLimit-Used: 5
All uppercase L in Limit!
For me it’s more a bug then a feature

According to the HTTP specification header names are case-insensitive, so both variants are equivalent. An easy way to deal with the differences is to convert all header names to lower case when parsing them.

For the header specification, see:

Thanks, but it would be a nice police to choose upper or lower. The problemis indeed easy to cope with, but it’s just as easy to introduce nasty bugs that are hard to see for a human eye.

I’d say it’s the other way around, the differences in case make it much easier to spot those bugs. One could even randomize case in headers. :wink:

Also, for many languages there are HTTP client libraries that take care of this for you. For example in Python requests has the headers in a case-insensitive dictionary, so something like this works:

import requests
r = requests.get('https://api.github.com/')
limit = r.headers['x-RaTeLiMiT-lImIt']