Skip to content

Why is the polyfill fetch library being used always? #361

@bobziroll

Description

@bobziroll

There's a conflict with React Router ≥ v6.4.5, where it always expects a response to have a body property. However, the whatwg-fetch library used by pretender is intercepting the Response created by React Router and appending a _bodyInit property instead of a body property. So React Router checks this Response with a duck-typing check, sees that it doesn't have a body property (which the W3 spec requires of a Response obj), and rejects it as not being a valid Response.

(In v6.4.4 they were checking it with instanceof Request which was passing that check.)

My question is, why is this polyfilled fetch being used instead of the native fetch when my browser has a native fetch? The native fetch doesn't have this problem.

Metadata

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