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

Function TestLogRequestDisplaysRequestDetails

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

Source from the content-addressed store, hash-verified

18}
19
20func 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
31x-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
42func TestLogResponseDisplaysResponseDetails(t *testing.T) {
43 var output bytes.Buffer

Callers

nothing calls this directly

Calls 4

LogRequestMethod · 0.95
NewDebugLoggerFunction · 0.85
NewRequestInfoFunction · 0.85
StringMethod · 0.80

Tested by

no test coverage detected