|
@@ -1560,6 +1560,26 @@ func TestContextRenderDataFromReader(t *testing.T) {
|
|
|
assert.Equal(t, extraHeaders["Content-Disposition"], w.HeaderMap.Get("Content-Disposition"))
|
|
assert.Equal(t, extraHeaders["Content-Disposition"], w.HeaderMap.Get("Content-Disposition"))
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+type TestResponseRecorder struct {
|
|
|
|
|
+ *httptest.ResponseRecorder
|
|
|
|
|
+ closeChannel chan bool
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func (r *TestResponseRecorder) CloseNotify() <-chan bool {
|
|
|
|
|
+ return r.closeChannel
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func (r *TestResponseRecorder) closeClient() {
|
|
|
|
|
+ r.closeChannel <- true
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func CreateTestResponseRecorder() *TestResponseRecorder {
|
|
|
|
|
+ return &TestResponseRecorder{
|
|
|
|
|
+ httptest.NewRecorder(),
|
|
|
|
|
+ make(chan bool, 1),
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
func TestContextStream(t *testing.T) {
|
|
func TestContextStream(t *testing.T) {
|
|
|
w := CreateTestResponseRecorder()
|
|
w := CreateTestResponseRecorder()
|
|
|
c, _ := CreateTestContext(w)
|
|
c, _ := CreateTestContext(w)
|