File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 12
12
13
13
before_install :
14
14
- export PATH=$PATH:$GOPATH/bin
15
- - go get golang.org/x/tools/cmd/vet
15
+ # - go get golang.org/x/tools/cmd/vet
16
16
- go get golang.org/x/tools/cmd/cover
17
17
- go get github.com/modocache/gover
18
18
- go get github.com/mattn/goveralls
Original file line number Diff line number Diff line change @@ -64,3 +64,27 @@ func TestResponse(t *testing.T) {
64
64
// reset
65
65
r .reset (httptest .NewRecorder (), New ())
66
66
}
67
+
68
+ func TestResponseWriteCommit (t * testing.T ) {
69
+ e := New ()
70
+ w := httptest .NewRecorder ()
71
+ r := NewResponse (w , e )
72
+
73
+ // Write body, it writes header if not committed yet
74
+ s := "echo"
75
+ r .Write ([]byte (s ))
76
+
77
+ assert .Equal (t , w .Code , 200 )
78
+ assert .Equal (t , w .Body .String (), s )
79
+
80
+ assert .Equal (t , r .Status (), 200 )
81
+ assert .Equal (t , r .Size (), int64 (4 ))
82
+ assert .True (t , r .Committed ())
83
+
84
+ // This is ignored with warning
85
+ r .WriteHeader (400 )
86
+
87
+ assert .Equal (t , r .Status (), 200 )
88
+ assert .Equal (t , r .Size (), int64 (4 ))
89
+ assert .True (t , r .Committed ())
90
+ }
You can’t perform that action at this time.
0 commit comments