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

flush operation will overwrite the origin status code #1460

Merged
merged 2 commits into from
Aug 7, 2018

Conversation

congcongke
Copy link
Contributor

@congcongke congcongke commented Aug 6, 2018

The status of responseWriter will be overwrite if flush was called. This is caused by the Flush of http.response.Flush().

@codecov
Copy link

codecov bot commented Aug 6, 2018

Codecov Report

Merging #1460 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1460      +/-   ##
==========================================
+ Coverage   98.68%   98.68%   +<.01%     
==========================================
  Files          36       36              
  Lines        1894     1895       +1     
==========================================
+ Hits         1869     1870       +1     
  Misses         18       18              
  Partials        7        7
Impacted Files Coverage Δ
response_writer.go 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9b7e7bd...a0d9ee5. Read the comment docs.

appleboy
appleboy previously approved these changes Aug 6, 2018
@appleboy
Copy link
Member

appleboy commented Aug 6, 2018

any feedback @thinkerou ?

javierprovecho
javierprovecho previously approved these changes Aug 6, 2018
writer := &responseWriter{}
writer.reset(w)

writer.WriteHeader(500)
Copy link
Member

Choose a reason for hiding this comment

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

I like http.StatusInternalServerError

// should return 500
resp, err := http.Get(testServer.URL)
assert.NoError(t, err)
assert.Equal(t, resp.StatusCode, 500)
Copy link
Member

Choose a reason for hiding this comment

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

use http.StatusInternalServerError? and you should use assert.Equal(t, expect, actual)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thank you! done

@thinkerou
Copy link
Member

thinkerou commented Aug 7, 2018

please see my comment, a small problem, and then LGTM.

@appleboy appleboy merged commit 0552c3b into gin-gonic:master Aug 7, 2018
@appleboy appleboy added this to the 1.3 milestone Aug 7, 2018
@appleboy appleboy added the bug label Aug 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants