Skip to content

Commit 58872d9

Browse files
vearutopcasualjim
authored andcommitted
Add host value to req.Host, resolves #145
Signed-off-by: Viacheslav Poturaev <vearutop@gmail.com>
1 parent 8a0a012 commit 58872d9

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

client/runtime.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ func (r *Runtime) Submit(operation *runtime.ClientOperation) (interface{}, error
374374
}
375375
req.URL.Scheme = r.pickScheme(operation.Schemes)
376376
req.URL.Host = r.Host
377+
req.Host = r.Host
377378

378379
r.clientOnce.Do(func() {
379380
r.client = &http.Client{

client/runtime_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,8 @@ func TestRuntime_CustomTransport(t *testing.T) {
549549
if req.URL.Scheme != "https" {
550550
return nil, errors.New("this was not a https request")
551551
}
552+
assert.Equal(t, "localhost:3245", req.Host)
553+
assert.Equal(t, "localhost:3245", req.URL.Host)
552554
var resp http.Response
553555
resp.StatusCode = 200
554556
resp.Header = make(http.Header)

0 commit comments

Comments
 (0)