Ensure the instrumentedResponseWriter correctly sets the http

status in the context.

Signed-off-by: Richard Scothern <richard.scothern@gmail.com>
This commit is contained in:
Richard 2015-05-05 14:21:33 -07:00
parent dd58ffe6ed
commit 70f853e787
3 changed files with 16 additions and 4 deletions

View file

@ -145,6 +145,10 @@ func TestWithResponseWriter(t *testing.T) {
t.Fatalf("unexpected response writer returned: %#v != %#v", grw, rw)
}
if ctx.Value("http.response.status") != 0 {
t.Fatalf("response status should always be a number and should be zero here: %v != 0", ctx.Value("http.response.status"))
}
if n, err := rw.Write(make([]byte, 1024)); err != nil {
t.Fatalf("unexpected error writing: %v", err)
} else if n != 1024 {