mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-01 08:34:02 +03:00
browser(firefox): preserve content-type from original request if it i… (#16739)
This commit is contained in:
parent
ff46d8ce8a
commit
a8249163d3
@ -1,2 +1,2 @@
|
||||
1347
|
||||
Changed: aslushnikov@gmail.com Sat Aug 13 14:56:35 MSK 2022
|
||||
1348
|
||||
Changed: yurys@chromium.org Mon Aug 22 16:59:01 PDT 2022
|
||||
|
@ -863,7 +863,7 @@ function setPostData(httpChannel, postData, headers) {
|
||||
const body = atob(postData);
|
||||
synthesized.setData(body, body.length);
|
||||
|
||||
const overriddenHeader = (lowerCaseName, defaultValue) => {
|
||||
const overriddenHeader = (lowerCaseName) => {
|
||||
if (headers) {
|
||||
for (const header of headers) {
|
||||
if (header.name.toLowerCase() === lowerCaseName) {
|
||||
@ -871,11 +871,22 @@ function setPostData(httpChannel, postData, headers) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return defaultValue;
|
||||
return undefined;
|
||||
}
|
||||
// Clear content-length, so that upload stream resets it.
|
||||
httpChannel.setRequestHeader('content-length', '', false /* merge */);
|
||||
httpChannel.explicitSetUploadStream(synthesized, overriddenHeader('content-type', 'application/octet-stream'), -1, httpChannel.requestMethod, false);
|
||||
let contentType = overriddenHeader('content-type');
|
||||
if (contentType === undefined) {
|
||||
try {
|
||||
contentType = httpChannel.getRequestHeader('content-type');
|
||||
} catch (e) {
|
||||
if (e.result == Cr.NS_ERROR_NOT_AVAILABLE)
|
||||
contentType = 'application/octet-stream';
|
||||
else
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
httpChannel.explicitSetUploadStream(synthesized, contentType, -1, httpChannel.requestMethod, false);
|
||||
}
|
||||
|
||||
function convertString(s, source, dest) {
|
||||
|
@ -1,2 +1,2 @@
|
||||
1345
|
||||
Changed: aslushnikov@gmail.com Sat Aug 13 14:45:35 MSK 2022
|
||||
1346
|
||||
Changed: yurys@chromium.org Mon Aug 22 16:56:24 PDT 2022
|
||||
|
@ -863,7 +863,7 @@ function setPostData(httpChannel, postData, headers) {
|
||||
const body = atob(postData);
|
||||
synthesized.setData(body, body.length);
|
||||
|
||||
const overriddenHeader = (lowerCaseName, defaultValue) => {
|
||||
const overriddenHeader = (lowerCaseName) => {
|
||||
if (headers) {
|
||||
for (const header of headers) {
|
||||
if (header.name.toLowerCase() === lowerCaseName) {
|
||||
@ -871,11 +871,22 @@ function setPostData(httpChannel, postData, headers) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return defaultValue;
|
||||
return undefined;
|
||||
}
|
||||
// Clear content-length, so that upload stream resets it.
|
||||
httpChannel.setRequestHeader('content-length', '', false /* merge */);
|
||||
httpChannel.explicitSetUploadStream(synthesized, overriddenHeader('content-type', 'application/octet-stream'), -1, httpChannel.requestMethod, false);
|
||||
let contentType = overriddenHeader('content-type');
|
||||
if (contentType === undefined) {
|
||||
try {
|
||||
contentType = httpChannel.getRequestHeader('content-type');
|
||||
} catch (e) {
|
||||
if (e.result == Cr.NS_ERROR_NOT_AVAILABLE)
|
||||
contentType = 'application/octet-stream';
|
||||
else
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
httpChannel.explicitSetUploadStream(synthesized, contentType, -1, httpChannel.requestMethod, false);
|
||||
}
|
||||
|
||||
function convertString(s, source, dest) {
|
||||
|
Loading…
Reference in New Issue
Block a user