Skip to content

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