Send Content-Type once on a delivery #331
@@ -339,10 +339,11 @@ func TestRedirectPolicy_StopsAtHopCap(t *testing.T) {
|
|||||||
// The set the redirect policy strips is whatever the delivery path
|
// 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
|
// 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
|
// 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
|
// is not in the set, and neither is the inbound Content-Type, because
|
||||||
// excluded: Content-Type describes the body, which a 307 carries
|
// it is not forwarded. Two more are deliberately excluded: a
|
||||||
// across hosts, and the inbound User-Agent every real sender supplies
|
// Content-Type configured on the target describes the body, which a
|
||||||
// is overwritten before the request goes out.
|
// 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) {
|
func TestApplyRequestHeaders_ReportsOriginScopedNames(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
@@ -371,6 +372,7 @@ func TestApplyRequestHeaders_ReportsOriginScopedNames(t *testing.T) {
|
|||||||
&delivery.HTTPTargetConfig{
|
&delivery.HTTPTargetConfig{
|
||||||
Headers: map[string]string{
|
Headers: map[string]string{
|
||||||
probeHeaderName: probeHeaderValue,
|
probeHeaderName: probeHeaderValue,
|
||||||
|
"Content-Type": testContentType,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@@ -378,7 +380,11 @@ func TestApplyRequestHeaders_ReportsOriginScopedNames(t *testing.T) {
|
|||||||
assert.Equal(t,
|
assert.Equal(t,
|
||||||
[]string{probeHeaderName, inboundHeaderName}, names,
|
[]string{probeHeaderName, inboundHeaderName}, names,
|
||||||
"both header classes are reported, and only those: "+
|
"both header classes are reported, and only those: "+
|
||||||
"Host is never forwarded, Content-Type and "+
|
"Host and the inbound Content-Type are never "+
|
||||||
"User-Agent are the delivery path's own",
|
"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