Skip to content

Commit

Permalink
chore: fix issue with headers
Browse files Browse the repository at this point in the history
  • Loading branch information
Lightning00Blade committed Sep 9, 2024
1 parent 2c74513 commit 17ff8fd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 28 deletions.
14 changes: 13 additions & 1 deletion src/bidiMapper/modules/network/NetworkRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ export class NetworkRequest {
bodySize?: number;
};

#responseOverrides?: {
statusCode?: number;
headers?: Network.Header[];
cookies?: Network.CookieHeader[];
};

#response: {
hasExtraInfo?: boolean;
info?: Protocol.Network.Response;
Expand Down Expand Up @@ -242,6 +248,7 @@ export class NetworkRequest {
/** Returns the HTTP status code associated with this request if any. */
get #statusCode(): number | undefined {
return (
this.#responseOverrides?.statusCode ??
this.#response.info?.status ??
this.#response.extraInfo?.statusCode ??
this.#response.paused?.responseStatusCode
Expand Down Expand Up @@ -634,6 +641,11 @@ export class NetworkRequest {
responseHeaders:
responseHeaders ?? this.#response.paused?.responseHeaders,
});

this.#responseOverrides = {
statusCode: overrides.statusCode,
headers: overrides.headers,
};
}
}

Expand Down Expand Up @@ -824,7 +836,7 @@ export class NetworkRequest {
this.#response.info?.fromDiskCache ||
this.#response.info?.fromPrefetchCache ||
this.#servedFromCache,
headers,
headers: this.#responseOverrides?.headers ?? headers,
mimeType: this.#response.info?.mimeType || '',
bytesReceived: this.#response.info?.encodedDataLength || 0,
headersSize: computeHeadersSize(headers),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,6 @@
[test_headers[headers2\]]
expected: FAIL

[test_headers_overrides_original_headers[headers0\]]
expected: FAIL

[test_headers_overrides_original_headers[headers1\]]
expected: FAIL

[test_headers_overrides_original_headers[headers2\]]
expected: FAIL

[test_set_cookie_header]
expected: FAIL

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,6 @@
[test_headers[headers2\]]
expected: FAIL

[test_headers_overrides_original_headers[headers0\]]
expected: FAIL

[test_headers_overrides_original_headers[headers1\]]
expected: FAIL

[test_headers_overrides_original_headers[headers2\]]
expected: FAIL

[test_set_cookie_header]
expected: FAIL

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,6 @@
[test_headers[headers2\]]
expected: FAIL

[test_headers_overrides_original_headers[headers0\]]
expected: FAIL

[test_headers_overrides_original_headers[headers1\]]
expected: FAIL

[test_headers_overrides_original_headers[headers2\]]
expected: FAIL

[test_set_cookie_header]
expected: FAIL

Expand Down

0 comments on commit 17ff8fd

Please sign in to comment.