@nxtedition/lib 20.4.0 → 20.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/http.js +60 -36
- package/package.json +1 -1
- package/serializers.js +1 -3
package/http.js
CHANGED
|
@@ -165,7 +165,7 @@ export class ServerResponse extends http.ServerResponse {
|
|
|
165
165
|
connect: -1,
|
|
166
166
|
headers: -1,
|
|
167
167
|
data: -1,
|
|
168
|
-
|
|
168
|
+
end: -1,
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
get timing() {
|
|
@@ -181,42 +181,54 @@ export class ServerResponse extends http.ServerResponse {
|
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
flushHeaders() {
|
|
184
|
-
if (this
|
|
185
|
-
this.#timing.headers
|
|
186
|
-
|
|
184
|
+
if (!this.destroyed) {
|
|
185
|
+
if (this.#timing.headers === -1) {
|
|
186
|
+
this.#timing.headers = performance.now() - this.#now
|
|
187
|
+
this.#now += this.#timing.headers
|
|
188
|
+
}
|
|
187
189
|
}
|
|
188
190
|
return super.flushHeaders()
|
|
189
191
|
}
|
|
190
192
|
|
|
191
193
|
write(chunk, encoding, callback) {
|
|
192
|
-
if (this
|
|
193
|
-
this.#timing.data
|
|
194
|
-
|
|
195
|
-
|
|
194
|
+
if (!this.destroyed) {
|
|
195
|
+
if (this.#timing.data === -1) {
|
|
196
|
+
this.#timing.data = performance.now() - this.#now
|
|
197
|
+
this.#now += this.#timing.data
|
|
198
|
+
}
|
|
196
199
|
|
|
197
|
-
|
|
198
|
-
|
|
200
|
+
if (this.#timing.headers === -1) {
|
|
201
|
+
this.#timing.headers = this.#timing.data
|
|
202
|
+
}
|
|
199
203
|
}
|
|
200
204
|
|
|
201
205
|
return super.write(chunk, encoding, callback)
|
|
202
206
|
}
|
|
203
207
|
|
|
204
208
|
end(chunk, encoding, callback) {
|
|
205
|
-
if (this
|
|
206
|
-
this.#timing.data
|
|
207
|
-
|
|
208
|
-
|
|
209
|
+
if (!this.destroyed) {
|
|
210
|
+
if (this.#timing.data === -1) {
|
|
211
|
+
this.#timing.data = performance.now() - this.#now
|
|
212
|
+
this.#now += this.#timing.data
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (this.#timing.headers === -1) {
|
|
216
|
+
this.#timing.headers = this.#timing.data
|
|
217
|
+
}
|
|
209
218
|
|
|
210
|
-
|
|
211
|
-
this.#
|
|
219
|
+
this.#timing.end = performance.now() - this.#now
|
|
220
|
+
this.#now += this.#timing.end
|
|
212
221
|
}
|
|
213
222
|
|
|
214
223
|
return super.end(chunk, encoding, callback)
|
|
215
224
|
}
|
|
216
225
|
|
|
217
226
|
destroy(err) {
|
|
218
|
-
if (this
|
|
219
|
-
this.#timing.
|
|
227
|
+
if (!this.destroyed) {
|
|
228
|
+
if (this.#timing.end === -1) {
|
|
229
|
+
this.#timing.end = performance.now() - this.#now
|
|
230
|
+
this.#now += this.#timing.end
|
|
231
|
+
}
|
|
220
232
|
}
|
|
221
233
|
|
|
222
234
|
return super.destroy(err)
|
|
@@ -230,7 +242,7 @@ export class Http2ServerResponse extends http2.Http2ServerResponse {
|
|
|
230
242
|
connect: -1,
|
|
231
243
|
headers: -1,
|
|
232
244
|
data: -1,
|
|
233
|
-
|
|
245
|
+
end: -1,
|
|
234
246
|
}
|
|
235
247
|
|
|
236
248
|
get timing() {
|
|
@@ -246,42 +258,54 @@ export class Http2ServerResponse extends http2.Http2ServerResponse {
|
|
|
246
258
|
}
|
|
247
259
|
|
|
248
260
|
flushHeaders() {
|
|
249
|
-
if (this
|
|
250
|
-
this.#timing.headers
|
|
251
|
-
|
|
261
|
+
if (!this.destroyed) {
|
|
262
|
+
if (this.#timing.headers === -1) {
|
|
263
|
+
this.#timing.headers = performance.now() - this.#now
|
|
264
|
+
this.#now += this.#timing.headers
|
|
265
|
+
}
|
|
252
266
|
}
|
|
253
267
|
return super.flushHeaders()
|
|
254
268
|
}
|
|
255
269
|
|
|
256
270
|
write(chunk, encoding, callback) {
|
|
257
|
-
if (this
|
|
258
|
-
this.#timing.data
|
|
259
|
-
|
|
260
|
-
|
|
271
|
+
if (!this.destroyed) {
|
|
272
|
+
if (this.#timing.data === -1) {
|
|
273
|
+
this.#timing.data = performance.now() - this.#now
|
|
274
|
+
this.#now += this.#timing.data
|
|
275
|
+
}
|
|
261
276
|
|
|
262
|
-
|
|
263
|
-
|
|
277
|
+
if (this.#timing.headers === -1) {
|
|
278
|
+
this.#timing.headers = this.#timing.data
|
|
279
|
+
}
|
|
264
280
|
}
|
|
265
281
|
|
|
266
282
|
return super.write(chunk, encoding, callback)
|
|
267
283
|
}
|
|
268
284
|
|
|
269
285
|
end(chunk, encoding, callback) {
|
|
270
|
-
if (this
|
|
271
|
-
this.#timing.data
|
|
272
|
-
|
|
273
|
-
|
|
286
|
+
if (!this.destroyed) {
|
|
287
|
+
if (this.#timing.data === -1) {
|
|
288
|
+
this.#timing.data = performance.now() - this.#now
|
|
289
|
+
this.#now += this.#timing.data
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
if (this.#timing.headers === -1) {
|
|
293
|
+
this.#timing.headers = this.#timing.data
|
|
294
|
+
}
|
|
274
295
|
|
|
275
|
-
|
|
276
|
-
this.#
|
|
296
|
+
this.#timing.end = performance.now() - this.#now
|
|
297
|
+
this.#now += this.#timing.end
|
|
277
298
|
}
|
|
278
299
|
|
|
279
300
|
return super.end(chunk, encoding, callback)
|
|
280
301
|
}
|
|
281
302
|
|
|
282
303
|
destroy(err) {
|
|
283
|
-
if (this
|
|
284
|
-
this.#timing.
|
|
304
|
+
if (!this.destroyed) {
|
|
305
|
+
if (this.#timing.end === -1) {
|
|
306
|
+
this.#timing.end = performance.now() - this.#now
|
|
307
|
+
this.#now += this.#timing.end
|
|
308
|
+
}
|
|
285
309
|
}
|
|
286
310
|
|
|
287
311
|
return super.destroy(err)
|
package/package.json
CHANGED
package/serializers.js
CHANGED
|
@@ -27,12 +27,10 @@ function getTiming(obj) {
|
|
|
27
27
|
return undefined
|
|
28
28
|
}
|
|
29
29
|
return {
|
|
30
|
-
created: timing.created ?? -1,
|
|
31
30
|
connect: timing.connect ?? -1,
|
|
32
31
|
headers: timing.headers ?? -1,
|
|
33
32
|
data: timing.data ?? -1,
|
|
34
|
-
|
|
35
|
-
error: timing.error ?? -1,
|
|
33
|
+
end: timing.end ?? timing.complete ?? timing.error ?? -1,
|
|
36
34
|
}
|
|
37
35
|
}
|
|
38
36
|
|