File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed
Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -61,8 +61,9 @@ var passthroughSkipHeaderNamesLower = map[string]struct{}{
6161 "cookie" : {},
6262
6363 // Additional headers that should not be forwarded by name-matching passthrough rules.
64- "host" : {},
65- "content-length" : {},
64+ "host" : {},
65+ "content-length" : {},
66+ "accept-encoding" : {},
6667
6768 // Do not passthrough credentials by wildcard/regex.
6869 "authorization" : {},
Original file line number Diff line number Diff line change @@ -79,3 +79,30 @@ func TestProcessHeaderOverride_NonTestKeepsClientHeaderPlaceholder(t *testing.T)
7979 require .NoError (t , err )
8080 require .Equal (t , "trace-123" , headers ["X-Upstream-Trace" ])
8181}
82+
83+ func TestProcessHeaderOverride_PassthroughSkipsAcceptEncoding (t * testing.T ) {
84+ t .Parallel ()
85+
86+ gin .SetMode (gin .TestMode )
87+ recorder := httptest .NewRecorder ()
88+ ctx , _ := gin .CreateTestContext (recorder )
89+ ctx .Request = httptest .NewRequest (http .MethodPost , "/v1/chat/completions" , nil )
90+ ctx .Request .Header .Set ("X-Trace-Id" , "trace-123" )
91+ ctx .Request .Header .Set ("Accept-Encoding" , "gzip" )
92+
93+ info := & relaycommon.RelayInfo {
94+ IsChannelTest : false ,
95+ ChannelMeta : & relaycommon.ChannelMeta {
96+ HeadersOverride : map [string ]any {
97+ "*" : "" ,
98+ },
99+ },
100+ }
101+
102+ headers , err := processHeaderOverride (info , ctx )
103+ require .NoError (t , err )
104+ require .Equal (t , "trace-123" , headers ["X-Trace-Id" ])
105+
106+ _ , hasAcceptEncoding := headers ["Accept-Encoding" ]
107+ require .False (t , hasAcceptEncoding )
108+ }
You can’t perform that action at this time.
0 commit comments