(t *testing.T)
| 96 | } |
| 97 | |
| 98 | func TestWriteThenReadHeader(t *testing.T) { |
| 99 | srw := newFakeResponse() |
| 100 | |
| 101 | tmpFileRespWriter, err := NewTmpFileResponseWriter(srw, testTmpWriterDir) |
| 102 | defer tmpFileRespWriter.Close() |
| 103 | if err != nil { |
| 104 | t.Fatalf("could not initate TmpFileResponseWriter error:%s", err) |
| 105 | return |
| 106 | } |
| 107 | tmpFileRespWriter.Write([]byte("this is a test1 of length 28")) |
| 108 | |
| 109 | cType := tmpFileRespWriter.GetCapturedContentType() |
| 110 | cEncoding := tmpFileRespWriter.GetCapturedContentEncoding() |
| 111 | cLength, _ := tmpFileRespWriter.GetCapturedContentLength() |
| 112 | if err != nil { |
| 113 | t.Fatalf("could not get ContentLength error:%s", err) |
| 114 | return |
| 115 | } |
| 116 | |
| 117 | if cType != "content-type-1" { |
| 118 | t.Fatalf("wrong value for contentType, got %s, expected %s", cType, "content-type-1") |
| 119 | } |
| 120 | if cEncoding != "content-encoding-1" { |
| 121 | t.Fatalf("wrong value for contentEncoding, got %s, expected %s", cEncoding, "content-encoding-1") |
| 122 | } |
| 123 | if cLength != 28 { |
| 124 | t.Fatalf("wrong value for contentLength, got %d, expected %d", cLength, 28) |
| 125 | } |
| 126 | |
| 127 | } |
| 128 | |
| 129 | func TestWriteThenReadContent(t *testing.T) { |
| 130 | srw := newFakeResponse() |
nothing calls this directly
no test coverage detected