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)
| 72 | // matchers compare the path only, so the host is asserted in the responder or |
| 73 | // not at all. |
| 74 | func StubUploadToHost(t *testing.T, reg *httpmock.Registry, host string, repositoryID int64, name string, status int, body string) { |
| 75 | reg.Register(uploadMatcher(repositoryID, name), func(req *http.Request) (*http.Response, error) { |
| 76 | assert.Equal(t, host, req.URL.Host) |
| 77 | return httpmock.StatusStringResponse(status, body)(req) |
| 78 | }) |
| 79 | } |
| 80 | |
| 81 | func uploadMatcher(repositoryID int64, name string) httpmock.Matcher { |
| 82 | return httpmock.QueryMatcher("POST", "user-attachments/assets", url.Values{ |