A delivery set Content-Type from the event's ContentType and then added the inbound Content-Type from the event's stored headers, so a target could receive two values. The inbound Content-Type is no longer forwarded from the stored headers; the receiver already saves it as the event's ContentType. Which value is sent is now stated at applyRequestHeaders: a Content-Type configured on the target, otherwise the event's ContentType, otherwise none. A configured one still survives a cross-origin 307/308 with its body. Model: opus-5-5
This commit was merged in pull request #331.
This commit is contained in:
@@ -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",
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user