MCPcopy Create free account
hub / github.com/UiPath/uipathcli / TestLogResponseDisplaysResponseDetails

Function TestLogResponseDisplaysResponseDetails

log/debug_logger_test.go:42–62  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

40}
41
42func 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
53x-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}

Callers

nothing calls this directly

Calls 4

LogResponseMethod · 0.95
NewDebugLoggerFunction · 0.85
StringMethod · 0.80
NewResponseInfoFunction · 0.70

Tested by

no test coverage detected