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

Request.resourceType doesnt match DevTools #734

Closed
ebidel opened this issue Sep 9, 2017 · 5 comments
Closed

Request.resourceType doesnt match DevTools #734

ebidel opened this issue Sep 9, 2017 · 5 comments
Assignees
Labels

Comments

@ebidel
Copy link
Contributor

ebidel commented Sep 9, 2017

request.resourceType doesn't always match the resourceType shown in devtools:

screen shot 2017-09-09 at 11 12 41 am

screen shot 2017-09-09 at 11 12 44 am

const puppeteer = require('puppeteer');
(async() => {
const browser = await puppeteer.launch();
const page = await browser.newPage();

const responses = [];
page.on('response', resp => {
  responses.push(resp);
});

page.on('load', resp => {
  responses.map(async (r, i) => {
    const request = await r.request();
    console.log(request.url, request.resourceType);
  });
});

await page.goto('https://news.ycombinator.com/', {waitUntil: 'networkidle'});
browser.close();
})();
@aslushnikov aslushnikov self-assigned this Sep 10, 2017
@aslushnikov
Copy link
Contributor

@ebidel interesting! Almost everything is reported as "Other".

DevTools workaround this by falling back to mimeType: DevTools code. This approach wouldn't work for us since we need resourceType to process interception, and the mimeType is only available in the response.

@ebidel
Copy link
Contributor Author

ebidel commented Sep 10, 2017

Could we provide something (request.mimeType property) that uses the mime module to figure out the type? Even if we can't fix this bug, that info would be useful by itself to write files with the proper extension, use new Blob(), etc.

@zicai
Copy link

zicai commented Sep 11, 2017

+1

@aslushnikov
Copy link
Contributor

@ebidel that's a protocol bug; I'll fix it upstream.

@aslushnikov
Copy link
Contributor

Upstream bug: crbug.com/765501

ithinkihaveacat pushed a commit to ithinkihaveacat/puppeteer that referenced this issue Oct 31, 2017
This gets us:

- Plural metrics names https://crrev.com/507885
- TargetInfoChanged on URL changes https://crrev.com/508049
- Sending proper resource types for requests https://crrev.com/667504

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

No branches or pull requests

3 participants