File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -240,10 +240,10 @@ export class CompressionFilter extends BaseFilter implements Filter {
240
240
this . sharedFilterConfig . serverSupportedEncodingHeader = serverSupportedEncodingsHeader ;
241
241
const serverSupportedEncodings = serverSupportedEncodingsHeader . split ( ',' ) ;
242
242
243
- if ( ( this . sendCompression instanceof DeflateHandler && ! serverSupportedEncodings . includes ( 'deflate' ) )
244
- || ( this . sendCompression instanceof GzipHandler && ! serverSupportedEncodings . includes ( 'gzip' ) ) ) {
245
- this . sendCompression = new IdentityHandler ( ) ;
246
- }
243
+ if ( ! serverSupportedEncodings . includes ( this . currentCompressionAlgorithm ) ) {
244
+ this . sendCompression = new IdentityHandler ( ) ;
245
+ this . currentCompressionAlgorithm = 'identity' ;
246
+ }
247
247
}
248
248
metadata . remove ( 'grpc-accept-encoding' ) ;
249
249
return metadata ;
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ import { loadProtoFile } from './common';
33
33
import { TestServiceClient , TestServiceHandlers } from './generated/TestService' ;
34
34
import { ProtoGrpcType as TestServiceGrpcType } from './generated/test_service' ;
35
35
import { Request__Output } from './generated/Request' ;
36
+ import { CompressionAlgorithms } from '../src/compression-algorithms' ;
36
37
37
38
const loadedTestServiceProto = protoLoader . loadSync ( 'test/fixtures/test_service.proto' , {
38
39
keepCase : true ,
@@ -683,7 +684,7 @@ describe('Compressed requests', () => {
683
684
`localhost:${ assignedPort } ` ,
684
685
grpc . credentials . createInsecure ( ) ,
685
686
{
686
- 'grpc.default_compression_algorithm' : 1
687
+ 'grpc.default_compression_algorithm' : CompressionAlgorithms . deflate
687
688
}
688
689
) ;
689
690
done ( ) ;
@@ -774,7 +775,7 @@ describe('Compressed requests', () => {
774
775
`localhost:${ assignedPort } ` ,
775
776
grpc . credentials . createInsecure ( ) ,
776
777
{
777
- 'grpc.default_compression_algorithm' : 2
778
+ 'grpc.default_compression_algorithm' : CompressionAlgorithms . gzip
778
779
}
779
780
) ;
780
781
You can’t perform that action at this time.
0 commit comments