File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414var createError = require ( 'http-errors' )
1515var getBody = require ( 'raw-body' )
1616var iconv = require ( 'iconv-lite' )
17- var onFinished = require ( 'on-finished' )
1817var zlib = require ( 'node:zlib' )
18+ const { finished } = require ( 'node:stream' )
1919
2020/**
2121 * Module exports.
@@ -201,10 +201,10 @@ function createDecompressionStream (encoding, debug) {
201201 */
202202
203203function dump ( req , callback ) {
204- if ( onFinished . isFinished ( req ) ) {
204+ if ( req . writableEnded || req . writabledFinished ) {
205205 callback ( null )
206206 } else {
207- onFinished ( req , callback )
207+ finished ( req , callback )
208208 req . resume ( )
209209 }
210210}
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ var bytes = require('bytes')
1616var contentType = require ( 'content-type' )
1717var createError = require ( 'http-errors' )
1818var debug = require ( 'debug' ) ( 'body-parser:json' )
19- var isFinished = require ( 'on-finished' ) . isFinished
2019var read = require ( '../read' )
2120var typeis = require ( 'type-is' )
2221
@@ -100,7 +99,7 @@ function json (options) {
10099 }
101100
102101 return function jsonParser ( req , res , next ) {
103- if ( isFinished ( req ) ) {
102+ if ( req . writableFinished ) {
104103 debug ( 'body already parsed' )
105104 next ( )
106105 return
Original file line number Diff line number Diff line change 1212
1313var bytes = require ( 'bytes' )
1414var debug = require ( 'debug' ) ( 'body-parser:raw' )
15- var isFinished = require ( 'on-finished' ) . isFinished
1615var read = require ( '../read' )
1716var typeis = require ( 'type-is' )
1817
@@ -54,7 +53,7 @@ function raw (options) {
5453 }
5554
5655 return function rawParser ( req , res , next ) {
57- if ( isFinished ( req ) ) {
56+ if ( req . writableFinished ) {
5857 debug ( 'body already parsed' )
5958 next ( )
6059 return
Original file line number Diff line number Diff line change 1313var bytes = require ( 'bytes' )
1414var contentType = require ( 'content-type' )
1515var debug = require ( 'debug' ) ( 'body-parser:text' )
16- var isFinished = require ( 'on-finished' ) . isFinished
1716var read = require ( '../read' )
1817var typeis = require ( 'type-is' )
1918
@@ -56,7 +55,7 @@ function text (options) {
5655 }
5756
5857 return function textParser ( req , res , next ) {
59- if ( isFinished ( req ) ) {
58+ if ( req . writableFinished ) {
6059 debug ( 'body already parsed' )
6160 next ( )
6261 return
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ var bytes = require('bytes')
1616var contentType = require ( 'content-type' )
1717var createError = require ( 'http-errors' )
1818var debug = require ( 'debug' ) ( 'body-parser:urlencoded' )
19- var isFinished = require ( 'on-finished' ) . isFinished
2019var read = require ( '../read' )
2120var typeis = require ( 'type-is' )
2221var qs = require ( 'qs' )
@@ -72,7 +71,7 @@ function urlencoded (options) {
7271 }
7372
7473 return function urlencodedParser ( req , res , next ) {
75- if ( isFinished ( req ) ) {
74+ if ( req . writableEnded || req . writableFinished ) {
7675 debug ( 'body already parsed' )
7776 next ( )
7877 return
You can’t perform that action at this time.
0 commit comments