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(mockResponse): writeHead() sets headersSent #313

Merged
merged 1 commit into from
Dec 9, 2024

Conversation

RobinTail
Copy link
Contributor

Fixes #312

According to documentation and my debugging findings writeHead():

Sends a response header to the request.

Meaning that it does actually set headersSent property to true.

This PR implements it and updates the test having wrong implication.

@RobinTail RobinTail changed the title fix(mockResponse): writeHead() sets headersSent. fix(mockResponse): writeHead() sets headersSent Dec 6, 2024
@RobinTail
Copy link
Contributor Author

@eugef , please review

@RobinTail
Copy link
Contributor Author

RobinTail commented Dec 6, 2024

For the context: I'm implementing an event streaming response and headers are sent before body to an alive kept connection.
https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events

@eugef
Copy link
Owner

eugef commented Dec 9, 2024

Hi @RobinTail, thanks for PR.

@eugef eugef merged commit 8618dd8 into eugef:master Dec 9, 2024
4 checks passed
@RobinTail
Copy link
Contributor Author

RobinTail commented Dec 9, 2024

May I ask you to publish the patch, @eugef ?

@eugef
Copy link
Owner

eugef commented Dec 10, 2024

Sure, new release 1.16.2 is published.

@RobinTail
Copy link
Contributor Author

I'm not sure why, @eugef , but it's not really published.

latest 1.16.1

@RobinTail
Copy link
Contributor Author

Perhaps there was an error, like expired NPM token or something similar?

@eugef
Copy link
Owner

eugef commented Dec 10, 2024

Ah. my bad, forgot to run npm publish command :)
New version should become available soon

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.

flushHeaders is not implemented on response mock
2 participants