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

Function getOutputWithHeaders

agent/agentproc/api_test.go:86–98  ·  view source on GitHub ↗

getOutputWithHeaders sends a GET /{id}/output request with custom headers and returns the recorder.

(t *testing.T, handler http.Handler, id string, headers http.Header)

Source from the content-addressed store, hash-verified

84// getOutputWithHeaders sends a GET /{id}/output request with
85// custom headers and returns the recorder.
86func getOutputWithHeaders(t *testing.T, handler http.Handler, id string, headers http.Header) *httptest.ResponseRecorder {
87 t.Helper()
88 ctx, cancel := context.WithTimeout(context.Background(), testutil.WaitLong)
89 defer cancel()
90 path := fmt.Sprintf("/%s/output", id)
91 req := httptest.NewRequestWithContext(ctx, http.MethodGet, path, nil)
92 for k, v := range headers {
93 req.Header[k] = v
94 }
95 w := httptest.NewRecorder()
96 handler.ServeHTTP(w, req)
97 return w
98}
99
100// postSignal sends a POST /{id}/signal request and returns
101// the recorder.

Callers 1

TestProcessOutputFunction · 0.85

Calls 2

HelperMethod · 0.65
ServeHTTPMethod · 0.45

Tested by

no test coverage detected