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)
| 84 | // getOutputWithHeaders sends a GET /{id}/output request with |
| 85 | // custom headers and returns the recorder. |
| 86 | func 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. |
no test coverage detected