test: add BinaryResponse helper function
Signed-off-by: Babak K. Shandiz <babakks@github.com>
This commit is contained in:
parent
f5134c48c0
commit
e0c7a328d2
1 changed files with 6 additions and 0 deletions
|
|
@ -127,6 +127,12 @@ func StringResponse(body string) Responder {
|
|||
}
|
||||
}
|
||||
|
||||
func BinaryResponse(body []byte) Responder {
|
||||
return func(req *http.Request) (*http.Response, error) {
|
||||
return httpResponse(200, req, bytes.NewBuffer(body)), nil
|
||||
}
|
||||
}
|
||||
|
||||
func WithHost(matcher Matcher, host string) Matcher {
|
||||
return func(req *http.Request) bool {
|
||||
if !strings.EqualFold(req.Host, host) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue