зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1207233 - Don't provide a default content-type header if user calls XHR.setRequestHeader('Content-Type', ''), r=jduell
This commit is contained in:
Родитель
39cabbcacc
Коммит
59b6510302
|
@ -2700,8 +2700,7 @@ nsXMLHttpRequest::Send(nsIVariant* aVariant, const Nullable<RequestBody>& aBody)
|
|||
nsAutoCString contentType;
|
||||
if (NS_FAILED(httpChannel->
|
||||
GetRequestHeader(NS_LITERAL_CSTRING("Content-Type"),
|
||||
contentType)) ||
|
||||
contentType.IsEmpty()) {
|
||||
contentType))) {
|
||||
contentType = defaultContentType;
|
||||
|
||||
if (!charset.IsEmpty()) {
|
||||
|
|
|
@ -721,8 +721,13 @@ HttpBaseChannel::ExplicitSetUploadStream(nsIInputStream *aStream,
|
|||
contentLengthStr.AppendInt(aContentLength);
|
||||
SetRequestHeader(NS_LITERAL_CSTRING("Content-Length"), contentLengthStr,
|
||||
false);
|
||||
SetRequestHeader(NS_LITERAL_CSTRING("Content-Type"), aContentType,
|
||||
false);
|
||||
|
||||
if (aContentType.IsEmpty()) {
|
||||
SetEmptyRequestHeader(NS_LITERAL_CSTRING("Content-Type"));
|
||||
} else {
|
||||
SetRequestHeader(NS_LITERAL_CSTRING("Content-Type"), aContentType,
|
||||
false);
|
||||
}
|
||||
}
|
||||
|
||||
mUploadStreamHasHeaders = aStreamHasHeaders;
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
[setrequestheader-content-type.htm]
|
||||
type: testharness
|
||||
[XMLHttpRequest: setRequestHeader() - Content-Type header ()]
|
||||
expected: FAIL
|
||||
|
Загрузка…
Ссылка в новой задаче