Case insensitive header params for API request


I am making API requests with token based Auth mechanism. Here is example request.

     method: 'POST',
     url: {URL HERE},
     headers: {'Authorization': Bearer {token}},
     params: {
        ... params ...
}).then...Handle the rest

The problem is with header param Authorization as per standards it should be case insensitive and almost all JS clients (Fetch, Axios) are converting headers to lowercase therefore it becomes authorization and server expects Authorization (with capital A).

My question is how to make all header params case insensitive? so it can accept params in any case.

, , Anwer AR 1 year 2020-07-26T13:11:03-05:00 0 Answers 52 views 0

Leave an answer