@@ -108,13 +108,16 @@ function constructRequestHeaders(
108
108
}
109
109
} ) ;
110
110
// Remove brotli from accept-encoding because cloudflare has problems with it
111
- if ( proxyHeaders [ 'accept-encoding' ] ?. includes ( 'br' ) )
112
- proxyHeaders [ 'accept-encoding' ] = proxyHeaders [
113
- 'accept-encoding'
114
- ] ?. replace ( 'br' , '' ) ;
111
+ // if (proxyHeaders['accept-encoding']?.includes('br'))
112
+ // proxyHeaders['accept-encoding'] = proxyHeaders[
113
+ // 'accept-encoding'
114
+ // ]?.replace('br', '');
115
115
}
116
116
const baseHeaders : any = {
117
117
'content-type' : 'application/json' ,
118
+ ...( requestHeaders [ 'accept-encoding' ] && {
119
+ 'accept-encoding' : requestHeaders [ 'accept-encoding' ] ,
120
+ } ) ,
118
121
} ;
119
122
120
123
let headers : Record < string , string > = { } ;
@@ -868,19 +871,19 @@ function updateResponseHeaders(
868
871
retryAttempt . toString ( )
869
872
) ;
870
873
871
- const contentEncodingHeader = response . headers . get ( 'content-encoding' ) ;
872
- if ( contentEncodingHeader && contentEncodingHeader . indexOf ( 'br' ) > - 1 ) {
873
- // Brotli compression causes errors at runtime, removing the header in that case
874
- response . headers . delete ( 'content-encoding' ) ;
875
- }
876
- if ( getRuntimeKey ( ) == 'node' ) {
877
- response . headers . delete ( 'content-encoding' ) ;
878
- }
874
+ // const contentEncodingHeader = response.headers.get('content-encoding');
875
+ // if (contentEncodingHeader && contentEncodingHeader.indexOf('br') > -1) {
876
+ // // Brotli compression causes errors at runtime, removing the header in that case
877
+ // response.headers.delete('content-encoding');
878
+ // }
879
+ // if (getRuntimeKey() == 'node') {
880
+ // response.headers.delete('content-encoding');
881
+ // }
879
882
880
883
// Delete content-length header to avoid conflicts with hono compress middleware
881
884
// workerd environment handles this authomatically
882
885
response . headers . delete ( 'content-length' ) ;
883
- response . headers . delete ( 'transfer-encoding' ) ;
886
+ // response.headers.delete('transfer-encoding');
884
887
if ( provider && provider !== POWERED_BY ) {
885
888
response . headers . append ( HEADER_KEYS . PROVIDER , provider ) ;
886
889
}
0 commit comments