aboutsummaryrefslogtreecommitdiff
path: root/middleware/recorder_test.go
blob: 30931a0e3c1b77d82f5f63406229686583882372 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package middleware

/*
func TestNewResponseRecorder(t *testing.T) {
	w := httptest.NewRecorder()
	recordRequest := NewResponseRecorder(w)
	if !(recordRequest.ResponseWriter == w) {
		t.Fatalf("Expected Response writer in the Recording to be same as the one sent\n")
	}
	if recordRequest.status != http.StatusOK {
		t.Fatalf("Expected recorded status  to be http.StatusOK (%d) , but found %d\n ", http.StatusOK, recordRequest.status)
	}
}

func TestWrite(t *testing.T) {
	w := httptest.NewRecorder()
	responseTestString := "test"
	recordRequest := NewResponseRecorder(w)
	buf := []byte(responseTestString)
	recordRequest.Write(buf)
	if recordRequest.size != len(buf) {
		t.Fatalf("Expected the bytes written counter to be %d, but instead found %d\n", len(buf), recordRequest.size)
	}
	if w.Body.String() != responseTestString {
		t.Fatalf("Expected Response Body to be %s , but found %s\n", responseTestString, w.Body.String())
	}
}
*/