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

v1: Fix ResponseData.Write behavior to match net/http.ResponseWriter.Write. #1326

Merged
merged 2 commits into from
Aug 3, 2017

Conversation

sotosof
Copy link

@sotosof sotosof commented Aug 3, 2017

Same as #1325 but into v1 branch.

From documentation of net/http.ResponseWriter.Write

    If WriteHeader has not yet been called, Write calls
    WriteHeader(http.StatusOK) before writing the data.

Without this fix, ResponseData which went through middleware which depends
on documented behavior of net/http.ResponseWriter.Write, basically which doesn't
call net/http.ResponseWriter.WriteHeader explicitly, ended in non Written
state. This leads into situation that NotFound handler will write into
ResponseData although middleware did the write already.
@raphael
Copy link
Member

raphael commented Aug 3, 2017

Thank you!

@raphael raphael merged commit 2a1ff6b into goadesign:v1 Aug 3, 2017
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.

2 participants