diff --git a/lib/response.ts b/lib/response.ts index 15bafc8..db3c494 100644 --- a/lib/response.ts +++ b/lib/response.ts @@ -84,9 +84,11 @@ export class Response extends Body { const contentType = headers.get( HTTP2_HEADER_CONTENT_TYPE ); const contentLength = headers.get( HTTP2_HEADER_CONTENT_LENGTH ); + const contentEncoding = + headers.get( HTTP2_HEADER_CONTENT_ENCODING ); const length = - contentLength == null + ( contentLength == null || contentEncoding != null ) ? null : parseInt( contentLength, 10 ); diff --git a/test/fetch-h2/nghttp2.org.ts b/test/fetch-h2/nghttp2.org.ts index a8463c9..45cf852 100644 --- a/test/fetch-h2/nghttp2.org.ts +++ b/test/fetch-h2/nghttp2.org.ts @@ -136,4 +136,11 @@ describe( "nghttp2.org/httpbin", function( ) await disconnectAll( ); } ); + + it( "should be possible to GET gzip data", async ( ) => + { + const response = await fetch( "https://nghttp2.org/httpbin/gzip" ); + const data = await response.json( ); + expect( data ).to.deep.include( { gzipped: true, method: "GET" } ); + } ); } );