MCPcopy Index your code
hub / github.com/coder/coder / TestRequestIDHelpers

Function TestRequestIDHelpers

coderd/httpmw/requestid_test.go:37–48  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

35}
36
37func TestRequestIDHelpers(t *testing.T) {
38 t.Parallel()
39
40 requestID := uuid.New()
41 ctx := httpmw.WithRequestID(context.Background(), requestID)
42 req := httptest.NewRequest(http.MethodGet, "/", nil).WithContext(ctx)
43
44 gotRequestID, ok := httpmw.RequestIDOptional(req)
45 require.True(t, ok)
46 require.Equal(t, requestID, gotRequestID)
47 require.Equal(t, requestID, httpmw.RequestID(req))
48}

Callers

nothing calls this directly

Calls 6

WithRequestIDFunction · 0.92
RequestIDOptionalFunction · 0.92
RequestIDFunction · 0.92
WithContextMethod · 0.80
NewMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected