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

middleware/errorhandler: Fix a bug which meant it never works #1958

Merged
merged 1 commit into from
Oct 31, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions common/middleware/errorhandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ func newErrorInterceptor(w http.ResponseWriter, code int) *errorInterceptor {
}

// Header implements http.ResponseWriter
func (i errorInterceptor) Header() http.Header {
func (i *errorInterceptor) Header() http.Header {
return i.headers
}

// WriteHeader implements http.ResponseWriter
func (i errorInterceptor) WriteHeader(code int) {
func (i *errorInterceptor) WriteHeader(code int) {
if i.gotCode {
panic("errorInterceptor.WriteHeader() called twice")
}
Expand All @@ -69,7 +69,7 @@ func (i errorInterceptor) WriteHeader(code int) {
}

// Write implements http.ResponseWriter
func (i errorInterceptor) Write(data []byte) (int, error) {
func (i *errorInterceptor) Write(data []byte) (int, error) {
if !i.gotCode {
i.WriteHeader(http.StatusOK)
}
Expand Down