danielgtaylor / restish

Restish is a CLI for interacting with REST-ish HTTP APIs with some nice features built-in
https://rest.sh/
MIT License
900 stars 74 forks source link

Header case modification makes restish unusable for some APIs with case senstive headers #230

Open dbalmain opened 10 months ago

dbalmain commented 10 months ago

Firstly, I love this tool. I was about to build something similar myself, but this does almost everything I need.

I realise HTTP headers are supposed to be case-insensitive, but the reality is that a lot of APIs have case-sensitive headers, and for the APIs I'm using, they do not match the canonical format that go uses. e.g. One API I'm trying to use expects the header X-SourceSystem but go canonicalises this as X-Sourcesystem.

To fix this, you would need to replace the .Add and .Set methods in restish with adding the header directly so that the case isn't canonicalised? Also, the headers coming out of the profile in the config seem to be downcased before they even get added to the request. I haven't figured out where that happens yet.