StubUploadToHost is StubUpload plus the host the request reached. The matchers compare the path only, so the host is asserted in the responder or not at all.
(t *testing.T, reg *httpmock.Registry, host string, repositoryID int64, name string, status int, body string)
| 52 | // matchers compare the path only, so the host is asserted in the responder or |
| 53 | // not at all. |
| 54 | func StubUploadToHost(t *testing.T, reg *httpmock.Registry, host string, repositoryID int64, name string, status int, body string) { |
| 55 | reg.Register(uploadMatcher(repositoryID, name), func(req *http.Request) (*http.Response, error) { |
| 56 | assert.Equal(t, host, req.URL.Host) |
| 57 | return httpmock.StatusStringResponse(status, body)(req) |
| 58 | }) |
| 59 | } |
| 60 | |
| 61 | func uploadMatcher(repositoryID int64, name string) httpmock.Matcher { |
| 62 | return httpmock.QueryMatcher("POST", "user-attachments/assets", url.Values{ |