-
Notifications
You must be signed in to change notification settings - Fork 541
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
Non-GET http2 requests without a body hang indefninitely #2589
Comments
Hey! Thanks for the report I believe this should be scope to validate wether or not there's a body at all being sent. Would you like to submit a PR? |
I'm confused. It should be possible to send a fetch without body? Also this sounds like we are missing something in the spec language? @KhafraDev |
this isn't an issue with fetch afaict |
While I was trying to investigate this problem, I discovered a completely different problem. When we pass body the following object appears: {
finalBody: {
stream: ReadableStream { locked: false, state: 'readable', supportsBYOB: true },
source: 'helloWorld',
length: 10
}
} (For this output I used output a variable called finalBody in undici/lib/fetch/request.js:505) Well, if we pass an object to body, then we get the following output: {
finalBody: {
stream: ReadableStream { locked: false, state: 'readable', supportsBYOB: true },
source: '[object Object]',
length: 15
}
} In this case, regardless of the size of our object, length will always be 15 and source will be incorrect. |
@timursevimli I believe the problem you're facing is not a bug, and not related to the problem I've posted in the OP. Try passing in your object as |
Proposed Solutions:
|
Given this works with HTTP/1.1, it's not a bug in |
I can verify that the script in the OP runs without issues on v6.4.0 of undici. Thanks everyone for the comments and @timursevimli for the PR! |
Bug Description
When using fetch to make non-GET/HEAD http2 requests, the function call hangs indefinitely. Passing in an empty string in place of the body fixes this issue.
Reproducible By
The following js script triggers the issue on undici v6.2.1
Expected Behavior
The function call should send the request with an empty body.
Environment
macOS 14.0, node v20.8.1, undici v6.2.1
Additional context
I believe the issue is closely related to #2258 , but while this PR had only fixed GET/HEAD requests, this actually affects all kinds of requests.
The text was updated successfully, but these errors were encountered: