MCPcopy Index your code
hub / github.com/ContentSquare/chproxy / TestWriteThenReadStatusCode

Function TestWriteThenReadStatusCode

cache/tmp_file_response_writer_test.go:166–190  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

164}
165
166func TestWriteThenReadStatusCode(t *testing.T) {
167 srw := newFakeResponse()
168 expectStatusCode1 := http.StatusOK
169 expectStatusCode2 := 444
170 tmpFileRespWriter, err := NewTmpFileResponseWriter(srw, testTmpWriterDir)
171 defer tmpFileRespWriter.Close()
172 if err != nil {
173 t.Fatalf("could not initate TmpFileResponseWriter error:%s", err)
174 return
175 }
176 statusCode := tmpFileRespWriter.StatusCode()
177
178 if expectStatusCode1 != statusCode {
179 t.Fatalf("wrong value for statusCode, got %d, expected %d", statusCode, expectStatusCode1)
180
181 }
182
183 tmpFileRespWriter.WriteHeader(expectStatusCode2)
184 statusCode = tmpFileRespWriter.StatusCode()
185 if expectStatusCode2 != statusCode {
186 t.Fatalf("wrong value for statusCode, got %d, expected %d", statusCode, expectStatusCode2)
187
188 }
189
190}

Callers

nothing calls this directly

Calls 5

CloseMethod · 0.95
StatusCodeMethod · 0.95
WriteHeaderMethod · 0.95
newFakeResponseFunction · 0.85
NewTmpFileResponseWriterFunction · 0.85

Tested by

no test coverage detected