getRaw issues a GET and returns the full response so header assertions are possible (getJSON discards headers).
(t *testing.T, url, bearer string)
| 17 | // getRaw issues a GET and returns the full response so header assertions are |
| 18 | // possible (getJSON discards headers). |
| 19 | func getRaw(t *testing.T, url, bearer string) *http.Response { |
| 20 | t.Helper() |
| 21 | req, _ := http.NewRequest("GET", url, nil) |
| 22 | if bearer != "" { |
| 23 | req.Header.Set("Authorization", "Bearer "+bearer) |
| 24 | } |
| 25 | resp, err := http.DefaultClient.Do(req) |
| 26 | if err != nil { |
| 27 | t.Fatal(err) |
| 28 | } |
| 29 | return resp |
| 30 | } |
| 31 | |
| 32 | func TestPollRateLimited(t *testing.T) { |
| 33 | srv := httptest.NewServer(New(Deps{ |
no outgoing calls
no test coverage detected