...
1 package httpsnoop
2
3 import (
4 "net/http/httptest"
5 "testing"
6 )
7
8 func TestUnwrap(t *testing.T) {
9 w := Wrap(httptest.NewRecorder(), Hooks{})
10 if _, ok := Unwrap(w).(*httptest.ResponseRecorder); !ok {
11 t.Error("expected ResponseRecorder")
12 }
13 }
14
15 func TestUnwrapWithoutWrap(t *testing.T) {
16 w := httptest.NewRecorder()
17 if _, ok := Unwrap(w).(*httptest.ResponseRecorder); !ok {
18 t.Error("expected ResponseRecorder")
19 }
20 }
21
22 func TestUnwrapMultipleLayers(t *testing.T) {
23 w := Wrap(Wrap(httptest.NewRecorder(), Hooks{}), Hooks{})
24 if _, ok := Unwrap(w).(*httptest.ResponseRecorder); !ok {
25 t.Error("expected ResponseRecorder")
26 }
27 }
28
View as plain text