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 #respond_with_status when headers written or closed #10415

Conversation

straight-shoota
Copy link
Member

This change makes HTTP::Server::Response#respond_with_status raise when the response is closed or headers have already been written.

ref. #10038 (comment)

This method is also completely broken when headers have already been sent, because the reset causes that flag to disapear and respond_with_status just writes a second response. https://carc.in/#/r/a2ha

This uses the same check_headers method as #10412.

The first commit is just a minor refactoring because the moved spec doesn't belong in the describe group for #respond_with_status.

Copy link
Member

@bcardiff bcardiff left a comment

Choose a reason for hiding this comment

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

test_alpine worked in this PR 😂

@straight-shoota
Copy link
Member Author

The gods must be pleased then.

@straight-shoota straight-shoota merged commit 5d031a4 into crystal-lang:master Feb 22, 2021
@straight-shoota straight-shoota deleted the fix/http-server-respond_with_status branch February 22, 2021 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants