diepm / vim-rest-console

A REST console for Vim.
658 stars 54 forks source link

Make http headers case-insensitive #94

Open michaelPotter opened 3 years ago

michaelPotter commented 3 years ago

Hi,

I was running into an issue where I was trying to set the content-type header to x-www-form-urlencoded, but VRC was sending TWO content-type headers, one with my value, and one with type json.

It looks like internally the default content-type is json and is set with the key "Content-Type". When I set the "content-type" header, the default wasn't being overridden because it uses a different case.

This PR makes all http headers lowercase upon processing so that you can't send multiple of the same header. Note that http headers are case-insensitive in the spec. https://stackoverflow.com/a/5259004