* Create a decompression stream for the given encoding. * @param {string} encoding * @param {Function} debug * @returns {Object} * @private
(encoding, debug)
| 212 | * @private |
| 213 | */ |
| 214 | function createDecompressionStream (encoding, debug) { |
| 215 | switch (encoding) { |
| 216 | case 'deflate': |
| 217 | debug('inflate body') |
| 218 | return zlib.createInflate() |
| 219 | case 'gzip': |
| 220 | debug('gunzip body') |
| 221 | return zlib.createGunzip() |
| 222 | case 'br': |
| 223 | debug('brotli decompress body') |
| 224 | return zlib.createBrotliDecompress() |
| 225 | default: |
| 226 | throw createError(415, 'unsupported content encoding "' + encoding + '"', { |
| 227 | encoding: encoding, |
| 228 | type: 'encoding.unsupported' |
| 229 | }) |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | /** |
| 234 | * Dump the contents of a request. |
no outgoing calls
no test coverage detected
searching dependent graphs…