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: do nothing if headers already sent #48

Merged
merged 2 commits into from
Jul 6, 2021
Merged

fix: do nothing if headers already sent #48

merged 2 commits into from
Jul 6, 2021

Conversation

Atinux
Copy link
Member

@Atinux Atinux commented Jul 6, 2021

No description provided.

src/index.js Outdated
@@ -8,6 +8,10 @@ module.exports = function createServePlaceholder (_options) {
const options = defu(_options, defaults)

return function servePlaceholderMiddleware (req, res, next) {
// If response already sent, skip
if (res.headersSent) {
Copy link
Member

Choose a reason for hiding this comment

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

Would be better using res.writableEnabled (https://nodejs.org/api/http.html#http_response_writableended)

Copy link
Member Author

@Atinux Atinux Jul 6, 2021

Choose a reason for hiding this comment

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

I can but this will reduce support to v12.9 but I guess it's fine since Node LTS is 14

Screenshot 2021-07-06 at 23 59 34
Screenshot 2021-07-07 at 00 00 07

Copy link
Member

Choose a reason for hiding this comment

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

Thanks. Main reason was h3 is also working with newer flag.

@pi0 pi0 merged commit c633c71 into master Jul 6, 2021
@pi0 pi0 deleted the fix/ignore-if-sent branch July 6, 2021 22:02
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.

None yet

2 participants