Skip to content

Undici fetch should at least warn on method: "patch" since it does not normalize like http #2294

@pckilgore

Description

@pckilgore

What is the problem this feature will solve?

I spent the better part of the morning debugging why outgoing requests starting failing for only our PATCH requests after moving to fetch from http for one of our internal tools.

It ultimately was because undici (to be fair, following the spec) does not normalize patch to PATCH unlike other common HTTP verbs.

But this is not the behavior of http, which normalizes patch to PATCH (all verbs, actually)

Node itself will reject a request where the verb is patch, as all other servers and services I have tested.

What is the feature you are proposing to solve the problem?

I propose node undici fetch emit a warning if the method "patch" is received as an option, informing the user that this HTTP method will not be normalized.

This would operate similar to how node emits (used to emit?) a warning if a promise rejection is not handled.

What alternatives have you considered?

I would frankly much rather prefer the old http behavior that normalizes all verbs, or at the very least makes an exception for PATCH, as the decision of a service to support patch with different semantics than PATCH strikes me as an extremely uncommon use case.

That said, I understand undici in particular favors specification compliance, so emitting a warning will be helpful in the short term as more folks like me move projects over to the native API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocsChanges related to the documentationfetch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions