Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion extras/dgoss/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ The following environment variables can be set to change the behavior of dgoss.
##### GOSS_PATH
Location of the goss binary to use. (Default: `$(which goss)`)

#### GOSS_FILE
##### GOSS_FILE
Name of the goss file to use. (Default: `goss.yaml`)

##### GOSS_OPTS
Expand Down Expand Up @@ -100,4 +100,5 @@ Strategy used for copying goss files into the docker container. If set to `'moun
(Default `'mount'`)

##### CONTAINER_LOG_OUTPUT
**NOTE:** this only works when `GOSS_FILES_STRATEGY` is set to `'mount'`.
Location of the file that contains tested container logs. Logs are retained only if the variable is set to a non-empty string. (Default `''`)
8 changes: 8 additions & 0 deletions integration-tests/goss/goss-shared.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,14 @@ interface:
contain-element:
have-prefix: '172.17'
http:
https://httpbin.org/headers:
Comment thread
johnk-novu marked this conversation as resolved.
status: 200
allow-insecure: false
timeout: 10000
request-headers:
- "Host: example.com"
headers: ["Content-Type: application/json"]
body: ['"Host": "example.com"']
https://httpbin.org/headers:
status: 200
allow-insecure: false
Expand Down
10 changes: 10 additions & 0 deletions system/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"io"
"net/http"
"os"
"strings"
"time"

Expand Down Expand Up @@ -40,6 +41,7 @@ func NewDefHTTP(httpStr string, system *System, config util.Config) HTTP {
str := strings.SplitN(r, ": ", 2)
headers.Add(str[0], str[1])
}
fmt.Printf("\nheaders: %v\n\n", headers)
Comment thread
johnk-novu marked this conversation as resolved.
Outdated
return &DefHTTP{
http: httpStr,
allowInsecure: config.AllowInsecure,
Expand Down Expand Up @@ -86,6 +88,14 @@ func (u *DefHTTP) setup() error {
return u.err
}
req.Header = u.RequestHeader.Clone()

if host, ok := u.RequestHeader["Host"]; ok {
if len(host) > 1 {
fmt.Fprintf(os.Stderr, "multiple host headers detected, using first: (%v)", host[0])
Comment thread
johnk-novu marked this conversation as resolved.
Outdated
}
req.Host = host[0]
}

if u.Username != "" || u.Password != "" {
req.SetBasicAuth(u.Username, u.Password)
}
Expand Down