0.3.49
This commit is contained in:
@@ -66,6 +66,9 @@ func TestTrailerStartedLogUsesOriginalClientIP(t *testing.T) {
|
||||
request := httptest.NewRequest(http.MethodPost, "/v1/items/film-1/trailers/report",
|
||||
bytes.NewBufferString(`{"candidateId":"youtube-1","provider":"youtube","phase":"started"}`))
|
||||
request.SetPathValue("id", "film-1")
|
||||
// The request reaches the gateway through the household reverse proxy, whose LAN
|
||||
// address is trusted by default, so its X-Forwarded-For is believed.
|
||||
request.RemoteAddr = "10.0.0.2:44321"
|
||||
request.Header.Set("X-Forwarded-For", "203.0.113.42, 10.0.0.2")
|
||||
request, _ = withRequestIdentity(request)
|
||||
identify(request.Context(), store.Session{Username: "viewer", DeviceName: "Lounge TV"})
|
||||
@@ -76,6 +79,7 @@ func TestTrailerStartedLogUsesOriginalClientIP(t *testing.T) {
|
||||
}
|
||||
page := events.Events(0, 10)
|
||||
if len(page.Events) != 1 || page.Events[0].Attributes["source_ip"] != "203.0.113.42" ||
|
||||
page.Events[0].Attributes["source_ip_via"] != "forwarded" ||
|
||||
page.Events[0].Message != "trailer playback started" {
|
||||
t.Fatalf("unexpected event: %+v", page.Events)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user