Closed Saeris closed 7 years ago
For your use case, it seems most appropriate to use the square bracket notation when accessing the headers:
headers["rate-limit"]
I'm hesitant to change the names for the headers, as it appears common naming conventions for HTTP Headers are Foo-Bar (hyphenated). This would be true for built in response headers as well, like Content-Encoding or Content-Type. If you wanted to access those via JavaScript dot notation, you would run into the same issue.
The current format of the Response Headers (hyphenated) causes issues in JavaScript (and possibly other languages) when using the dot notation for accessing properties of objects, forcing the use of bracket notation instead. Examples:
JavaScript prefers camelCase for variable/property names, so that would be the ideal naming convention, but if this conflicts with other SDK's this might not be the best choice, wherein snake_case would be an acceptable alternative. More info:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_Accessors
Suggested names for the existing headers: