Skip to content

Fetch 401 behavior nodejs #4767

Description

@xconverge

Bug Description

I have been using the library for a long time, and up until v7.19.0, had no problems with unauthorized checks and 401 returns. I have a few different unit tests that use fetch against some unauthorized paths and check to make sure that 401s are correctly returned.

v7.19.0 introduced the 401 infinite loop issue and new authentication behavior and then v7.19.1 fixed/adjusted that in #4761

I am still a little confused, am I supposed to be able to actually get the 401 anymore, something still seems off to me?

In the return/error for test/fetch/401-statuscode-no-infinite-loop.js is there any way to get that it was a 401 (like the test cases in https://github.com/nodejs/undici/pull/4756/changes#diff-95de560a29bdff1c72b0c3af8fef710333db9464257e92a85784594b623cc68c)?

Environment

Node v22 and v24

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions