mirror of
https://github.com/appium/appium.git
synced 2026-10-28 20:31:51 +08:00
fix(base-driver): Exclude proxied headers from the server response (#21120)
This commit is contained in:
@@ -428,18 +428,13 @@ export class JWProxy {
|
||||
/** @type {import('@appium/types').HTTPMethod} */ (req.method),
|
||||
req.body
|
||||
);
|
||||
for (const [name, value] of _.toPairs(response.headers)) {
|
||||
if (!_.isNil(value)) {
|
||||
res.setHeader(name, _.isBoolean(value) ? String(value) : value);
|
||||
}
|
||||
}
|
||||
statusCode = response.statusCode;
|
||||
} catch (err) {
|
||||
[statusCode, resBodyObj] = getResponseForW3CError(
|
||||
isErrorType(err, errors.ProxyRequestError) ? err.getActualError() : err
|
||||
);
|
||||
}
|
||||
res.set('content-type', 'application/json; charset=utf-8');
|
||||
res.setHeader('content-type', 'application/json; charset=utf-8');
|
||||
if (!_.isPlainObject(resBodyObj)) {
|
||||
const error = new errors.UnknownError(
|
||||
`The downstream server response with the status code ${statusCode} is not a valid JSON object: ` +
|
||||
|
||||
@@ -7,9 +7,6 @@ function buildReqRes(url, method, body) {
|
||||
let req = {originalUrl: url, method, body};
|
||||
let res = {};
|
||||
res.headers = {};
|
||||
res.set = (k, v) => {
|
||||
res[k] = v;
|
||||
};
|
||||
res.setHeader = (k, v) => {
|
||||
res.headers[k] = v;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user