Skip to content

Commit a870716

Browse files
authored
Stop depend on the github.com/getkin/kin-openapi/routers/legacy (#383)
* Stop depend on the github.com/getkin/kin-openapi/routers/legacy * Fix tests for 031723a
1 parent e1e3453 commit a870716

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

request_helpers.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ func (r *RequestBuilder) WithHeader(header, value string) *RequestBuilder {
8585
return r
8686
}
8787

88+
func (r *RequestBuilder) WithHost(value string) *RequestBuilder {
89+
return r.WithHeader("Host", value)
90+
}
91+
8892
func (r *RequestBuilder) WithContentType(value string) *RequestBuilder {
8993
return r.WithHeader("Content-Type", value)
9094
}
@@ -146,6 +150,9 @@ func (r *RequestBuilder) GoWithHTTPHandler(t *testing.T, handler http.Handler) *
146150
for h, v := range r.Headers {
147151
req.Header.Add(h, v)
148152
}
153+
if host, ok := r.Headers["Host"]; ok {
154+
req.Host = host
155+
}
149156
for _, c := range r.Cookies {
150157
req.AddCookie(c)
151158
}

0 commit comments

Comments
 (0)