(t *testing.T)
| 68 | } |
| 69 | |
| 70 | func TestRequestWithHeader(t *testing.T) { |
| 71 | reg := &httpmock.Registry{} |
| 72 | defer reg.Verify(t) |
| 73 | client := newTestClient(reg) |
| 74 | |
| 75 | reg.Register(httpmock.MatchAny, httpmock.StatusStringResponse(200, "{}")) |
| 76 | |
| 77 | resp, err := client.Request("github.com", http.MethodGet, "repos/OWNER/REPO", nil, |
| 78 | WithHeader("Accept", "application/vnd.github.raw")) |
| 79 | require.NoError(t, err) |
| 80 | defer resp.Body.Close() |
| 81 | |
| 82 | assert.Equal(t, "application/vnd.github.raw", reg.Requests[0].Header.Get("Accept")) |
| 83 | } |
| 84 | |
| 85 | // The transport supplies default headers of its own, so a per-request header is only useful if it |
| 86 | // takes precedence over them. |
nothing calls this directly
no test coverage detected