Skip to content

Commit f25490e

Browse files
committed
Can disable header checking!
1 parent 69a689b commit f25490e

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

lib/XMLHttpRequest.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ exports.XMLHttpRequest = function() {
3030

3131
// Request settings
3232
var settings = {};
33+
34+
//headerscheck
35+
var disableHeaderChecking = false;
3336

3437
// Set some default headers
3538
var defaultHeaders = {
@@ -116,7 +119,14 @@ exports.XMLHttpRequest = function() {
116119
* @return boolean False if not allowed, otherwise true
117120
*/
118121
var isAllowedHttpHeader = function(header) {
119-
return (header && forbiddenRequestHeaders.indexOf(header.toLowerCase()) === -1);
122+
if (disableHeaderChecking)
123+
{
124+
return true
125+
}
126+
else
127+
{
128+
return (header && forbiddenRequestHeaders.indexOf(header.toLowerCase()) === -1);
129+
}
120130
};
121131

122132
/**
@@ -162,6 +172,19 @@ exports.XMLHttpRequest = function() {
162172

163173
setState(this.OPENED);
164174
};
175+
176+
177+
/**
178+
* Disables or enables isAllowedHttpHeader() check the request. Enabled by default.
179+
*
180+
* @param State true or false
181+
*
182+
* This is a more advance feature. This does not conform to the W3C spec
183+
*
184+
*/
185+
this.disableHeaderCheck = function(state) {
186+
disableHeaderChecking = state;
187+
}
165188

166189
/**
167190
* Sets a header for the request.

0 commit comments

Comments
 (0)