diff --git a/v2/background/src/request.ts b/v2/background/src/request.ts index cf83f8a..f17f2a0 100644 --- a/v2/background/src/request.ts +++ b/v2/background/src/request.ts @@ -69,13 +69,13 @@ export abstract class Intercepted implements InterceptedData { if (obj.url && obj.url != this.url) { modified.url = obj.url; } - if (obj.requestHeaders && JSON.stringify(obj.requestHeaders) != JSON.stringify(this.requestHeaders)) { - modified.headers = obj.requestHeaders.reduce((ret, header) => - Object.assign({ [header.name]: header.value }, ret), {}); - } if (obj.requestBody && obj.requestBody != this.requestBody) { modified.postData = obj.requestBody; } + if (obj.requestHeaders && (JSON.stringify(obj.requestHeaders) != JSON.stringify(this.requestHeaders) || modified.postData)) { + modified.headers = obj.requestHeaders.reduce((ret, header) => + Object.assign({ [header.name]: header.value }, ret), {}); + } return modified; }