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

Support 204 no-content for node 18 #127

Open
tompuric opened this issue Apr 6, 2023 · 0 comments
Open

Support 204 no-content for node 18 #127

tompuric opened this issue Apr 6, 2023 · 0 comments

Comments

@tompuric
Copy link

tompuric commented Apr 6, 2023

In Node.js 18, an experimental global fetch API is available by default (https://nodejs.dev/en/blog/announcements/v18-release-announce#fetch-experimental). axios-fetch currently assumes node-fetch as the underlying fetch mechanism.

This has compatibility issues in Node v18's fetch implementation for handling of 204 no-content results.

Nodes fetch (backed by undici) expects a 204 response to have a nullable body, however axios-fetch returns an empty buffer, resulting in the following error

TypeError {
    message: 'Response constructor: Invalid response status code 204',
}

The expectation is that axios-fetch also returns a nullable body for 204 no-content responses.

The current workaround to this is to avoid utilising nodes fetch impl via --no-experimental-fetch or override our global references with node-fetch

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

No branches or pull requests

1 participant