Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] route.fulfill failed with TimeoutError if the response headers contains newline #2358

Closed
char101 opened this issue May 26, 2020 · 1 comment
Assignees

Comments

@char101
Copy link

char101 commented May 26, 2020

Context:

  • Playwright Version: 1.0.2
  • Operating System: Windows
  • Node version: 14.2.0
  • Browser: chromium

Code Snippet

const { chromium } = require('playwright');

(async () => {
  const browser = await chromium.launch();
  const context = await browser.newContext();
  await context.route('**/*', async route => {
    route.fulfill({
      status: 200,
      headers: {
        x: 'a\nb',
      },
      body: '<h1>Title</h1>',
    });
  });
  const page = await context.newPage();
  await page.goto('http://localhost/');
  console.log(await page.content());
  await browser.close();
})();

Describe the bug

route.fulfill hang if fed with response containing newline in its value but on the other hand response.headers() joins multiple headers (like multiple set-cookie headers) into a single line separated with newline.

set-cookie: a
set-cookie: b

becomes

{'set-cookie': 'a\nb'}

when fetch via response.headers().
I think there should be a standard on how to handle header field with multiple values. Having it returns and receive Array is better in my opinion.

@JoelEinbinder
Copy link
Contributor

I think there should be a standard on how to handle header field with multiple values. Having it returns and receive Array is better in my opinion.

Agreed. It is a little bit more involved because we need to maintain backwards compatibility with the objects. Filed as #3184 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants