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

fix: DELETE requests should not call stream.end #362

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

karl-power
Copy link
Contributor

@karl-power karl-power commented Apr 10, 2024

It appears that DELETE streams behave the same as GET streams in that they are not writable (immediately ended?), so calling .end on the stream throws a write after end error (related issue).

I cannot find this documented anywhere in HTTP2 spec or in NodeJS HTTP2 module (aside from the endStream header, and http2stream.endAfterHeaders which don't seem to affect anything here - can anyone share insight?).

This PR simply adds the DELETE method to a check on whether or not to end the stream. The change fixes fastify/fastify-http-proxy#253.

Checklist

Copy link

@simoneb simoneb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job. This change LGTM, but I'd like to wait for somebody else's review before merging.

Copy link
Member

@gurgunday gurgunday left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, lgtm

@gurgunday
Copy link
Member

It appears that DELETE streams behave the same as GET streams in that they are not writable (immediately ended?), so calling .end on the stream throws a write after end error (fastify/fastify-http-proxy#253).

Yeah I thought for the same reasons when approving, that DELETE requests are like GET requests, but I just learned that they actually might have a body, so they can be writable (?) – maybe for all practical purposes it is interpreted the same way

Not 100% sure if this is the reason or not

@karl-power
Copy link
Contributor Author

Hi @mcollina & @climba03003
Any idea if this is the right approach here?

@mcollina mcollina merged commit 0c215ec into fastify:master Apr 22, 2024
19 checks passed
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

Successfully merging this pull request may close these issues.

All DELETE requests are failling when using HTTP2
4 participants