fix(http): headers should be case-insensitive.

fixes #9452

spec at https://tools.ietf.org/html/rfc2616
This commit is contained in:
Zhicheng Wang
2016-07-26 12:30:43 +08:00
committed by Victor Berchet
parent e34a04d2ad
commit 7f647822bd
4 changed files with 40 additions and 25 deletions

View File

@ -152,18 +152,18 @@ export class XHRConnection implements Connection {
case ContentType.NONE:
break;
case ContentType.JSON:
_xhr.setRequestHeader('Content-Type', 'application/json');
_xhr.setRequestHeader('content-type', 'application/json');
break;
case ContentType.FORM:
_xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;charset=UTF-8');
_xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');
break;
case ContentType.TEXT:
_xhr.setRequestHeader('Content-Type', 'text/plain');
_xhr.setRequestHeader('content-type', 'text/plain');
break;
case ContentType.BLOB:
var blob = req.blob();
if (blob.type) {
_xhr.setRequestHeader('Content-Type', blob.type);
_xhr.setRequestHeader('content-type', blob.type);
}
break;
}