-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #616 from CircleCI-Public/fix-host
Fix issue where config.Endpoint was being passed as a url prefix instead of config.Host
- Loading branch information
Showing
3 changed files
with
99 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package mock | ||
|
||
import ( | ||
"io/ioutil" | ||
"net/http" | ||
"strings" | ||
) | ||
|
||
type transport struct { | ||
f func(*http.Request) (*http.Response, error) | ||
} | ||
|
||
func (t *transport) RoundTrip(r *http.Request) (*http.Response, error) { | ||
return t.f(r) | ||
} | ||
|
||
func NewHTTPClient(f func(*http.Request) (*http.Response, error)) *http.Client { | ||
return &http.Client{ | ||
Transport: &transport{f: f}, | ||
} | ||
} | ||
|
||
func NewHTTPResponse(code int, body string) *http.Response { | ||
return &http.Response{ | ||
StatusCode: code, | ||
Body: ioutil.NopCloser(strings.NewReader(body)), | ||
} | ||
} |