File tree 1 file changed +5
-12
lines changed
1 file changed +5
-12
lines changed Original file line number Diff line number Diff line change @@ -109,12 +109,10 @@ class Polling extends Transport {
109
109
return ;
110
110
}
111
111
112
- const isBinary = "application/octet-stream" === req . headers [ "content-type" ] ;
113
-
114
112
this . dataReq = req ;
115
113
this . dataRes = res ;
116
114
117
- let chunks = isBinary ? Buffer . concat ( [ ] ) : "" ;
115
+ let chunks = "" ;
118
116
const self = this ;
119
117
120
118
function cleanup ( ) {
@@ -131,16 +129,11 @@ class Polling extends Transport {
131
129
132
130
function onData ( data ) {
133
131
let contentLength ;
134
- if ( isBinary ) {
135
- chunks = Buffer . concat ( [ chunks , data ] ) ;
136
- contentLength = chunks . length ;
137
- } else {
138
- chunks += data ;
139
- contentLength = Buffer . byteLength ( chunks ) ;
140
- }
132
+ chunks += data ;
133
+ contentLength = Buffer . byteLength ( chunks ) ;
141
134
142
135
if ( contentLength > self . maxHttpBufferSize ) {
143
- chunks = isBinary ? Buffer . concat ( [ ] ) : "" ;
136
+ chunks = "" ;
144
137
req . connection . destroy ( ) ;
145
138
}
146
139
}
@@ -161,7 +154,7 @@ class Polling extends Transport {
161
154
}
162
155
163
156
req . on ( "close" , onClose ) ;
164
- if ( ! isBinary ) req . setEncoding ( "utf8" ) ;
157
+ req . setEncoding ( "utf8" ) ;
165
158
req . on ( "data" , onData ) ;
166
159
req . on ( "end" , onEnd ) ;
167
160
}
You can’t perform that action at this time.
0 commit comments