Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions packages/playwright-core/src/server/bidi/bidiBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export class BidiBrowserContext extends BrowserContext {
userContexts: [this._userContextId()],
}));
}
if (this._options.extraHTTPHeaders || this._options.locale)
if (this._options.extraHTTPHeaders)
promises.push(this.doUpdateExtraHTTPHeaders());
await Promise.all(promises);
}
Expand Down Expand Up @@ -326,9 +326,7 @@ export class BidiBrowserContext extends BrowserContext {
}

async doUpdateExtraHTTPHeaders(): Promise<void> {
let allHeaders = this._options.extraHTTPHeaders || [];
if (this._options.locale)
allHeaders = network.mergeHeaders([allHeaders, network.singleHeader('Accept-Language', this._options.locale)]);
const allHeaders = this._options.extraHTTPHeaders || [];
await this._browser._browserSession.send('network.setExtraHeaders', {
headers: allHeaders.map(({ name, value }) => ({ name, value: { type: 'string', value } })),
userContexts: [this._userContextId()],
Expand Down
2 changes: 0 additions & 2 deletions packages/playwright-core/src/server/bidi/bidiPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,9 @@ export class BidiPage implements PageDelegate {
}

async updateExtraHTTPHeaders(): Promise<void> {
const locale = this._browserContext._options.locale;
const allHeaders = network.mergeHeaders([
this._browserContext._options.extraHTTPHeaders,
this._page.extraHTTPHeaders(),
locale ? network.singleHeader('Accept-Language', locale) : undefined,
]);
await this._session.send('network.setExtraHeaders', {
headers: allHeaders.map(({ name, value }) => ({ name, value: { type: 'string', value } })),
Expand Down
Loading