Skip to content

Commit

Permalink
accept ::1 as valid X-Forwarded-For value in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vojtad committed Feb 3, 2022
1 parent c25b052 commit 0ecde59
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/puma-dev/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ func runPlatformAgnosticTestScenarios(t *testing.T) {

dumpedHeaders := parseDumpedHTTPHeadersFromBody(getURLWithHost(t, reqURL, statusHost))

assert.Equal(t, "127.0.0.1", dumpedHeaders["HTTP_X_FORWARDED_FOR"])
assert.Regexp(t, `127\.0\.0\.1|::1`, dumpedHeaders["HTTP_X_FORWARDED_FOR"])
assert.Equal(t, "http", dumpedHeaders["HTTP_X_FORWARDED_PROTO"])
})

Expand All @@ -332,7 +332,7 @@ func runPlatformAgnosticTestScenarios(t *testing.T) {

dumpedHeaders := parseDumpedHTTPHeadersFromBody(getURLWithHost(t, reqURL, statusHost))

assert.Equal(t, "127.0.0.1", dumpedHeaders["HTTP_X_FORWARDED_FOR"])
assert.Regexp(t, `^127\.0\.0\.1|::1`, dumpedHeaders["HTTP_X_FORWARDED_FOR"])
assert.Equal(t, "https", dumpedHeaders["HTTP_X_FORWARDED_PROTO"])
})
}

0 comments on commit 0ecde59

Please sign in to comment.