test: add BinaryResponse helper function

Signed-off-by: Babak K. Shandiz <babakks@github.com>
This commit is contained in:
Babak K. Shandiz 2025-07-04 14:09:09 +01:00
parent f5134c48c0
commit e0c7a328d2
No known key found for this signature in database
GPG key ID: 9472CAEFF56C742E

View file

@ -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) {