File tree Expand file tree Collapse file tree 3 files changed +9
-26
lines changed Expand file tree Collapse file tree 3 files changed +9
-26
lines changed Original file line number Diff line number Diff line change @@ -22,8 +22,7 @@ var debug = require('debug')('compression')
22
22
var onHeaders = require ( 'on-headers' )
23
23
var vary = require ( 'vary' )
24
24
var zlib = require ( 'zlib' )
25
- var isUint8Array = require ( '@stdlib/assert-is-uint8array' )
26
- const { ServerResponse } = require ( 'http' )
25
+ var { ServerResponse } = require ( 'http' )
27
26
28
27
/**
29
28
* Module exports.
@@ -38,6 +37,10 @@ module.exports.filter = shouldCompress
38
37
*/
39
38
40
39
var cacheControlNoTransformRegExp = / (?: ^ | , ) \s * ?n o - t r a n s f o r m \s * ?(?: , | $ ) /
40
+ var hasUint8Array = ( typeof Uint8Array === 'function' )
41
+ function isUint8Array ( arg ) {
42
+ return hasUint8Array && arg && ( arg instanceof Uint8Array || arg . toString ( ) === '[object Uint8Array]' )
43
+ }
41
44
42
45
/**
43
46
* Compress response data with gzip / deflate.
Original file line number Diff line number Diff line change 9
9
"license" : " MIT" ,
10
10
"repository" : " expressjs/compression" ,
11
11
"dependencies" : {
12
- "@stdlib/assert-is-uint8array" : " ^0.0.8" ,
13
12
"accepts" : " ~1.3.8" ,
14
13
"bytes" : " 3.0.0" ,
15
14
"compressible" : " ~2.0.18" ,
29
28
"eslint-plugin-standard" : " 4.1.0" ,
30
29
"mocha" : " 9.2.2" ,
31
30
"nyc" : " 15.1.0" ,
32
- "supertest" : " 6.2.3" ,
33
- "sinon" : " 4.5.0"
31
+ "semver" : " ^7.3.7" ,
32
+ "sinon" : " 4.5.0" ,
33
+ "supertest" : " 6.2.3"
34
34
},
35
35
"files" : [
36
36
" LICENSE" ,
42
42
},
43
43
"scripts" : {
44
44
"lint" : " eslint ." ,
45
- "test" : " mocha --check-leaks -- reporter spec --bail" ,
45
+ "test" : " mocha --check-leaks -reporter spec --bail" ,
46
46
"test-ci" : " nyc --reporter=lcovonly --reporter=text npm test" ,
47
47
"test-cov" : " nyc --reporter=html --reporter=text npm test"
48
48
}
Original file line number Diff line number Diff line change @@ -111,26 +111,6 @@ describe('compression()', function () {
111
111
} )
112
112
} )
113
113
114
- it ( 'res.write() should throw ERR_STREAM_DESTROYED when stream is already destroyed' , function ( done ) {
115
- var server = createServer ( { threshold : 0 } , function ( req , res ) {
116
- res . setHeader ( 'Content-Type' , 'text/plain' )
117
- res . end ( 'hello world' )
118
-
119
- server . on ( 'close' , function ( ) {
120
- res . write ( 'hello world' , function ( err ) {
121
- assert . ok ( err . code === 'ERR_STREAM_DESTROYED' )
122
- } )
123
- } )
124
- } )
125
-
126
- request ( server )
127
- . get ( '/' )
128
- . set ( 'Accept-Encoding' , 'gzip' )
129
- . expect ( shouldHaveHeader ( 'Content-Encoding' ) )
130
- . expect ( shouldHaveBodyLength ( 'hello world' . length ) )
131
- . expect ( 200 , done )
132
- } )
133
-
134
114
it ( 'res.write() should throw ERR_STREAM_ALREADY_FINISHED when stream is already finished' , function ( done ) {
135
115
var server = createServer ( { threshold : 0 } , function ( req , res ) {
136
116
res . setHeader ( 'Content-Type' , 'text/plain' )
You can’t perform that action at this time.
0 commit comments