Skip to content

Commit

Permalink
Merge pull request #1958 from weaveworks/mike/middleware/errorhandler
Browse files Browse the repository at this point in the history
middleware/errorhandler: Fix a bug which meant it never works
  • Loading branch information
ekimekim authored Oct 31, 2016
2 parents 654ba35 + 6173e54 commit 96058b1
Showing 1 changed file with 3 additions and 3 deletions.
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

0 comments on commit 96058b1

Please sign in to comment.