Skip to content

puppeteer.HTTPRequest resourceType() returns string instead of a resource type enum #6854

Closed
@davidbielik

Description

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 7.0.4
  • Platform / OS version: Mac
  • URLs (if applicable): n/a
  • Node.js version: v10

I want to ask about difference while migrating from @types/puppeteer to the included definitions (thank you btw!)

In the past (with DefinitelyTyped), request resource types were defined ("document", "xhr", etc.):

page.on("request", request => {
   const resourceType = request.resourceType(); // puppeteer.ResourceType
});

Now, it returns string. I see there is a puppeteer.Protocol.Network.ResourceType (although those are not lowercased).

Is there a type we can use for this instead of string? Same for request.method() which also now returns string instead of the old DefinitelyTyped puppeteer.HttpMethod.

Thank you!

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions