fix: allow binary response interception (#9236)

This commit is contained in:
Max Schmitt 2021-09-30 23:12:33 +02:00 committed by GitHub
parent a1558d5c70
commit a1d0878fa1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -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;

View File

@ -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 => {