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] corrupted post data on application/x-protobuffer (probably other non-string postData formats) #2588

Closed
nickchisiu opened this issue Jun 16, 2020 · 0 comments · Fixed by #3196
Assignees

Comments

@nickchisiu
Copy link

nickchisiu commented Jun 16, 2020

Context:

  • Playwright Version: 1.1.0
  • Operating System: Mac
  • Node version: 10.16.0
  • Browser: All
  • Extra: -

Code Snippet

code snippet:

const {chromium, webkit, firefox} = require('playwright');

(async () => {
  const browser = await chromium.launch();
  const browserContext = await browser.newContext();
  const page = await browserContext.newPage();

  await browserContext.route('**/*', async route => {
    const postData = route.request().postData();

    if (postData) {
      console.log('request: ', request);
      console.log('postdata: ', JSON.stringify(postData));
    }
    
    route.continue({
      postData: postData ? postData : undefined
    });
  });

  await page.goto('https://recaptcha-demo.appspot.com/recaptcha-v3-request-scores.php');
})();

bug

I'm trying to mock an API application/x-protobuffer endpoint. The main issue is that the request().postData() method is changing/corrupting the body data somehow. The bug can be checked with the code snippet I provided. It doesn't work if you try to continue the request with the post data provided by request().postData() object but if you change the route to route.continue() without adding the playwright postData object inside the page is rendered as expected.

I've noticed the XHR request is not shown at all via the chrome inspector on each case, including the working one.

Firefox is not returning any postData at all for the application/x-protobuffer endpoint in cause and I get null each time

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

Successfully merging a pull request may close this issue.

2 participants