diff --git a/runner/run.go b/runner/run.go index 8a46b41..8417689 100644 --- a/runner/run.go +++ b/runner/run.go @@ -165,8 +165,14 @@ func RunStage(runContext *TestRunContext, ftwCheck *check.FTWCheck, testCase sch Protocol: testInput.GetProtocol(), } + // Get the host header from the test input + host := testInput.GetHeaders().Get("Host") + if host == "" { + host = "localhost" + } + if notRunningInCloudMode(ftwCheck) { - startMarker, err := markAndFlush(runContext, dest, stageID) + startMarker, err := markAndFlush(runContext, host, dest, stageID) if err != nil && !expectErr { return fmt.Errorf("failed to find start marker: %w", err) } @@ -190,7 +196,7 @@ func RunStage(runContext *TestRunContext, ftwCheck *check.FTWCheck, testCase sch } if notRunningInCloudMode(ftwCheck) { - endMarker, err := markAndFlush(runContext, dest, stageID) + endMarker, err := markAndFlush(runContext, host, dest, stageID) if err != nil && !expectErr { return fmt.Errorf("failed to find end marker: %w", err) @@ -220,7 +226,7 @@ func RunStage(runContext *TestRunContext, ftwCheck *check.FTWCheck, testCase sch return nil } -func markAndFlush(runContext *TestRunContext, dest *ftwhttp.Destination, stageID string) ([]byte, error) { +func markAndFlush(runContext *TestRunContext, host string, dest *ftwhttp.Destination, stageID string) ([]byte, error) { rline := &ftwhttp.RequestLine{ Method: "GET", // Use the `/status` endpoint of `httpbin` (http://httpbingo.org), if possible, @@ -233,7 +239,7 @@ func markAndFlush(runContext *TestRunContext, dest *ftwhttp.Destination, stageID headers := &ftwhttp.Header{ "Accept": "*/*", "User-Agent": "go-ftw test agent", - "Host": "localhost", + "Host": host, runContext.Config.LogMarkerHeaderName: stageID, }