Bug 1933239 - Update HTTP Accept header when fetching a JSON module. r=dom-core,necko-reviewers,frontend-codestyle-reviewers,mossop,valentin,sefeng
According to https://fetch.spec.whatwg.org/#fetching If the request's destination is "json", the Accept value in HTTP header should be set to `application/json,*/*;q=0.5`. Differential Revision: https://phabricator.services.mozilla.com/D235837
This commit is contained in:
@@ -885,10 +885,8 @@ nsresult ScriptLoader::PrepareHttpRequestAndInitiatorType(
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (httpChannel) {
|
||||
// HTTP content negotation has little value in this context.
|
||||
nsAutoCString acceptTypes("*/*");
|
||||
rv = httpChannel->SetRequestHeader("Accept"_ns, acceptTypes, false);
|
||||
MOZ_ASSERT(NS_SUCCEEDED(rv));
|
||||
// The 'Accept' HTTP header should be set in
|
||||
// nsHttpHandler::AddStandardRequestHeaders.
|
||||
|
||||
nsCOMPtr<nsIReferrerInfo> referrerInfo =
|
||||
new ReferrerInfo(aRequest->mReferrer, aRequest->ReferrerPolicy());
|
||||
|
||||
Reference in New Issue
Block a user