From 2ae6f4be30aee50e888ffe9bfa13a5b49d610e33 Mon Sep 17 00:00:00 2001 From: clawbot <35+clawbot@noreply.example.org> Date: Tue, 29 Sep 2026 04:15:07 +0000 Subject: [PATCH] Cover the kept Content-Type in the origin-scoped names test TestApplyRequestHeaders_ReportsOriginScopedNames now configures a Content-Type on the target and asserts it is not among the returned names, so dropping the delete in applyRequestHeaders fails it. Its comment now says the inbound Content-Type is absent because it is not forwarded. Model: opus-5-5 --- internal/delivery/redirect_test.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/internal/delivery/redirect_test.go b/internal/delivery/redirect_test.go index 1534697..e5d5347 100644 --- a/internal/delivery/redirect_test.go +++ b/internal/delivery/redirect_test.go @@ -339,10 +339,11 @@ func TestRedirectPolicy_StopsAtHopCap(t *testing.T) { // The set the redirect policy strips is whatever the delivery path // actually put on the wire, so a header added to the forward set is // covered without a second edit. A header the event never carried -// is not in the set, and the delivery path's own two are deliberately -// excluded: Content-Type describes the body, which a 307 carries -// across hosts, and the inbound User-Agent every real sender supplies -// is overwritten before the request goes out. +// is not in the set, and neither is the inbound Content-Type, because +// it is not forwarded. Two more are deliberately excluded: a +// Content-Type configured on the target describes the body, which a +// 307 carries across hosts, and the inbound User-Agent every real +// sender supplies is overwritten before the request goes out. func TestApplyRequestHeaders_ReportsOriginScopedNames(t *testing.T) { t.Parallel() @@ -371,6 +372,7 @@ func TestApplyRequestHeaders_ReportsOriginScopedNames(t *testing.T) { &delivery.HTTPTargetConfig{ Headers: map[string]string{ probeHeaderName: probeHeaderValue, + "Content-Type": testContentType, }, }, ) @@ -378,7 +380,11 @@ func TestApplyRequestHeaders_ReportsOriginScopedNames(t *testing.T) { assert.Equal(t, []string{probeHeaderName, inboundHeaderName}, names, "both header classes are reported, and only those: "+ - "Host is never forwarded, Content-Type and "+ - "User-Agent are the delivery path's own", + "Host and the inbound Content-Type are never "+ + "forwarded, User-Agent is the delivery path's own", + ) + assert.NotContains(t, names, "Content-Type", + "a Content-Type configured on the target must survive "+ + "a cross-origin 307/308 with the body it describes", ) }