How to remove HTTP specific headers in Javascript

前端 未结 4 986
情歌与酒
情歌与酒 2020-12-31 04:41

Is it possible to, before sending a http message, remove some specific http headers using javascript / XmlHttpRequest ?

I\'m using a proprietary browser, so there\'s

4条回答
  •  佛祖请我去吃肉
    2020-12-31 05:03

    Adam's answer didn't work for me. However, the following did:

    xhr.setRequestHeader('Authorization', ' ');
    

    notice, second parameter is a string containing a space instead of empty space. It does not remove header completely, but sets it to the empty string, which might be enough for some cases.

提交回复
热议问题