1- import http from 'http' ;
2- import zlib from 'zlib' ;
1+ import http from 'node: http' ;
2+ import zlib from 'node: zlib' ;
33import test from 'ava' ;
44import getStream from 'get-stream' ;
55import pify from 'pify' ;
6- import { createServer } from './_server ' ;
7- import decompressResponse from '.. ' ;
6+ import decompressResponse from '../index.js ' ;
7+ import { createServer } from './_server.js ' ;
88
99const zlibP = pify ( zlib ) ;
1010const httpGetP = pify ( http . get , { errorFirst : false } ) ;
@@ -91,18 +91,16 @@ test('decompress deflated content', async t => {
9191 t . is ( await getStream ( response ) , fixture ) ;
9292} ) ;
9393
94- if ( typeof zlib . brotliCompress === 'function' ) {
95- test ( 'decompress brotli content' , async t => {
96- const response = decompressResponse ( await httpGetP ( `${ server . url } /brotli` ) ) ;
94+ test ( 'decompress brotli content' , async t => {
95+ const response = decompressResponse ( await httpGetP ( `${ server . url } /brotli` ) ) ;
9796
98- t . is ( typeof response . httpVersion , 'string' ) ;
99- t . truthy ( response . headers ) ;
97+ t . is ( typeof response . httpVersion , 'string' ) ;
98+ t . truthy ( response . headers ) ;
10099
101- response . setEncoding ( 'utf8' ) ;
100+ response . setEncoding ( 'utf8' ) ;
102101
103- t . is ( await getStream ( response ) , fixture ) ;
104- } ) ;
105- }
102+ t . is ( await getStream ( response ) , fixture ) ;
103+ } ) ;
106104
107105test ( 'does not ignore missing data' , async t => {
108106 const response = decompressResponse ( await httpGetP ( `${ server . url } /missing-data` ) ) ;
@@ -114,7 +112,7 @@ test('does not ignore missing data', async t => {
114112
115113 await t . throwsAsync ( getStream ( response ) , {
116114 message : 'unexpected end of file' ,
117- code : 'Z_BUF_ERROR'
115+ code : 'Z_BUF_ERROR' ,
118116 } ) ;
119117} ) ;
120118
0 commit comments