(t *testing.T)
| 150 | } |
| 151 | |
| 152 | func TestDumpRequestBodyWriteCloser(t *testing.T) { |
| 153 | var buf bytes.Buffer |
| 154 | opt := &testOptions{ |
| 155 | output: &buf, |
| 156 | requestBody: true, |
| 157 | requestBodyOut: &buf, |
| 158 | } |
| 159 | d := NewDumper(opt) |
| 160 | |
| 161 | var inner bytes.Buffer |
| 162 | wc := &nopWriteCloser{&inner} |
| 163 | wrapped := d.WrapRequestBodyWriteCloser(wc) |
| 164 | |
| 165 | _, err := wrapped.Write([]byte("request body")) |
| 166 | if err != nil { |
| 167 | t.Fatalf("unexpected error: %v", err) |
| 168 | } |
| 169 | if buf.String() != "request body" { |
| 170 | t.Fatalf("expected 'request body' in dump, got %q", buf.String()) |
| 171 | } |
| 172 | if inner.String() != "request body" { |
| 173 | t.Fatalf("expected 'request body' in inner writer, got %q", inner.String()) |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | func TestGetDumpersWithContext(t *testing.T) { |
| 178 | var buf bytes.Buffer |
nothing calls this directly
no test coverage detected
searching dependent graphs…