mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix: allow binary response interception (#9236)
This commit is contained in:
parent
a1558d5c70
commit
a1d0878fa1
@ -231,11 +231,11 @@ export class Route extends SdkObject {
|
||||
const context = this._request.frame()._page._browserContext;
|
||||
const buffer = context.fetchRequest.fetchResponses.get(overrides.fetchResponseUid) || FetchRequest.findResponseBody(overrides.fetchResponseUid);
|
||||
assert(buffer, 'Fetch response has been disposed');
|
||||
body = buffer.toString('utf8');
|
||||
isBase64 = false;
|
||||
body = buffer.toString('base64');
|
||||
isBase64 = true;
|
||||
} else if (this._response && overrides.useInterceptedResponseBody) {
|
||||
body = (await this._delegate.responseBody()).toString('utf8');
|
||||
isBase64 = false;
|
||||
body = (await this._delegate.responseBody()).toString('base64');
|
||||
isBase64 = true;
|
||||
} else {
|
||||
body = '';
|
||||
isBase64 = false;
|
||||
|
||||
@ -596,8 +596,8 @@ it('should be able to download a PDF file', async ({ browser, server, asset }) =
|
||||
await page.close();
|
||||
});
|
||||
|
||||
it('should be able to download a inline PDF file', async ({ browser, server, asset }) => {
|
||||
it.fixme();
|
||||
it('should be able to download a inline PDF file', async ({ browser, server, asset, browserName }) => {
|
||||
it.fixme(browserName === 'webkit');
|
||||
const page = await browser.newPage({ acceptDownloads: true });
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await page.route('**/empty.pdf', async route => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user