(t *testing.T)
| 40 | } |
| 41 | |
| 42 | func TestLogResponseDisplaysResponseDetails(t *testing.T) { |
| 43 | var output bytes.Buffer |
| 44 | logger := NewDebugLogger(&output) |
| 45 | |
| 46 | body := bytes.NewBufferString(`{"hello":"world"}`) |
| 47 | header := map[string][]string{ |
| 48 | "x-request-id": {"my-request-id"}, |
| 49 | } |
| 50 | logger.LogResponse(*NewResponseInfo(http.StatusOK, "200 OK", "HTTP/1.1", header, body)) |
| 51 | |
| 52 | expectedOutput := `HTTP/1.1 200 OK |
| 53 | x-request-id: my-request-id |
| 54 | |
| 55 | {"hello":"world"} |
| 56 | |
| 57 | |
| 58 | ` |
| 59 | if output.String() != expectedOutput { |
| 60 | t.Errorf("Standard output should contain request, but got: %v", output.String()) |
| 61 | } |
| 62 | } |
nothing calls this directly
no test coverage detected