(t *testing.T)
| 30 | } |
| 31 | |
| 32 | func TestApiRequest_AuthForwarding(t *testing.T) { |
| 33 | var capturedAuth string |
| 34 | s := newTestServerWithMock(t, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 35 | capturedAuth = r.Header.Get("Authorization") |
| 36 | w.WriteHeader(http.StatusOK) |
| 37 | fmt.Fprint(w, `{}`) |
| 38 | })) |
| 39 | |
| 40 | ctx := withAccessToken(context.Background(), "test-token-123") |
| 41 | resp, err := s.apiRequest(ctx, "/api/test", nil) |
| 42 | require.NoError(t, err) |
| 43 | require.Equal(t, http.StatusOK, resp.Status) |
| 44 | require.Equal(t, "Bearer test-token-123", capturedAuth) |
| 45 | } |
| 46 | |
| 47 | func TestApiRequest_ErrorParsing(t *testing.T) { |
| 48 | s := newTestServerWithMock(t, http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { |
nothing calls this directly
no test coverage detected