(t *testing.T)
| 18 | } |
| 19 | |
| 20 | func TestLogRequestDisplaysRequestDetails(t *testing.T) { |
| 21 | var output bytes.Buffer |
| 22 | logger := NewDebugLogger(&output) |
| 23 | |
| 24 | body := bytes.NewBufferString(`{"hello":"world"}`) |
| 25 | header := map[string][]string{ |
| 26 | "x-request-id": {"my-request-id"}, |
| 27 | } |
| 28 | logger.LogRequest(*NewRequestInfo("POST", "https://cloud.uipath.com/my-service", "HTTP/1.1", header, body)) |
| 29 | |
| 30 | expectedOutput := `POST https://cloud.uipath.com/my-service HTTP/1.1 |
| 31 | x-request-id: my-request-id |
| 32 | |
| 33 | {"hello":"world"} |
| 34 | |
| 35 | |
| 36 | ` |
| 37 | if output.String() != expectedOutput { |
| 38 | t.Errorf("Standard output should contain request, but got: %v", output.String()) |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | func TestLogResponseDisplaysResponseDetails(t *testing.T) { |
| 43 | var output bytes.Buffer |
nothing calls this directly
no test coverage detected