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 no way to do it using browser specific solution.
For example, I want to remove the header 'Authorization' before send the message
POST /social/rpc?oauth_version=1.0& ... HTTP/1.1
Accept: text/html, image/png, image/*, */*
Accept-Language: ko
Authorization: Basic Og==
Host: test.myhost.com
Regards
delete() The delete() method of the Headers interface deletes a header from the current Headers object.
The dp:remove-http-request-header function removes a specific header field and its associated value from the protocol header of a client request. If the client request contains the header field that is identified by the name parameter, the function removes this header field from the client request.
Click Page Setup. Click the Margins & Headers/Footers tab. Change the top three and bottom three drop-down menus to "--blank--" if you want to remove all the headers and footers.
You could use the setRequestHeader method of the XmlHttpRequest object assuming your browser supports it, It is part of the W3C spec. It is also implemented by IE.
var req = new XMLHttpRequest();
req.setRequestHeader("Authorization", "");
When I use jquery-file-upload, and want to remove the header in the options
method, setting it to null
or ''
doesn't work for me. I use this instead:
req.setRequestHeader("Authorization");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With