@nxtedition/lib 23.7.5 → 23.7.6
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 +39 -6
- package/package.json +2 -2
package/http.js
CHANGED
|
@@ -8,6 +8,7 @@ import compose from 'koa-compose'
|
|
|
8
8
|
import http from 'http'
|
|
9
9
|
import fp from 'lodash/fp.js'
|
|
10
10
|
import tp from 'timers/promises'
|
|
11
|
+
import querystring from 'fast-querystring'
|
|
11
12
|
|
|
12
13
|
export const kAbortController = Symbol('abortController')
|
|
13
14
|
|
|
@@ -351,10 +352,13 @@ export async function requestMiddleware(ctx, next) {
|
|
|
351
352
|
}
|
|
352
353
|
|
|
353
354
|
export class IncomingMessage extends http.IncomingMessage {
|
|
354
|
-
#target
|
|
355
355
|
#host
|
|
356
356
|
#url
|
|
357
357
|
#socket
|
|
358
|
+
#target
|
|
359
|
+
|
|
360
|
+
#search
|
|
361
|
+
#query
|
|
358
362
|
|
|
359
363
|
constructor(...args) {
|
|
360
364
|
super(...args)
|
|
@@ -370,13 +374,26 @@ export class IncomingMessage extends http.IncomingMessage {
|
|
|
370
374
|
this.#url !== this.url ||
|
|
371
375
|
this.#socket !== this.socket
|
|
372
376
|
) {
|
|
373
|
-
this.#
|
|
377
|
+
this.#socket = this.socket
|
|
374
378
|
this.#host = this.headers.host
|
|
375
379
|
this.#url = this.url
|
|
376
|
-
this.#
|
|
380
|
+
this.#target = undefined
|
|
377
381
|
}
|
|
382
|
+
|
|
378
383
|
return (this.#target ??= requestTarget(this))
|
|
379
384
|
}
|
|
385
|
+
|
|
386
|
+
get query() {
|
|
387
|
+
const search = this.target.search
|
|
388
|
+
|
|
389
|
+
if (this.#search !== search) {
|
|
390
|
+
this.#search = search
|
|
391
|
+
this.#query = undefined
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
return (this.#query ??=
|
|
395
|
+
search.length > 1 ? Object.freeze(querystring.parse(search.slice(1))) : {})
|
|
396
|
+
}
|
|
380
397
|
}
|
|
381
398
|
|
|
382
399
|
export class ServerResponse extends http.ServerResponse {
|
|
@@ -479,10 +496,13 @@ export class ServerResponse extends http.ServerResponse {
|
|
|
479
496
|
}
|
|
480
497
|
|
|
481
498
|
export class Http2ServerRequest extends http2.Http2ServerRequest {
|
|
482
|
-
#target
|
|
483
499
|
#host
|
|
484
500
|
#url
|
|
485
501
|
#socket
|
|
502
|
+
#target
|
|
503
|
+
|
|
504
|
+
#search
|
|
505
|
+
#query
|
|
486
506
|
|
|
487
507
|
constructor(...args) {
|
|
488
508
|
super(...args)
|
|
@@ -498,13 +518,26 @@ export class Http2ServerRequest extends http2.Http2ServerRequest {
|
|
|
498
518
|
this.#url !== this.url ||
|
|
499
519
|
this.#socket !== this.socket
|
|
500
520
|
) {
|
|
501
|
-
this.#
|
|
521
|
+
this.#socket = this.socket
|
|
502
522
|
this.#host = this.headers.host
|
|
503
523
|
this.#url = this.url
|
|
504
|
-
this.#
|
|
524
|
+
this.#target = undefined
|
|
505
525
|
}
|
|
526
|
+
|
|
506
527
|
return (this.#target ??= requestTarget(this))
|
|
507
528
|
}
|
|
529
|
+
|
|
530
|
+
get query() {
|
|
531
|
+
const search = this.target.search
|
|
532
|
+
|
|
533
|
+
if (this.#search !== search) {
|
|
534
|
+
this.#search = search
|
|
535
|
+
this.#query = undefined
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
return (this.#query ??=
|
|
539
|
+
search.length > 1 ? Object.freeze(querystring.parse(search.slice(1))) : {})
|
|
540
|
+
}
|
|
508
541
|
}
|
|
509
542
|
|
|
510
543
|
export class Http2ServerResponse extends http2.Http2ServerResponse {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nxtedition/lib",
|
|
3
|
-
"version": "23.7.
|
|
3
|
+
"version": "23.7.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Robert Nagy <robert.nagy@boffins.se>",
|
|
6
6
|
"type": "module",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"@swc/wasm-web": "^1.11.22",
|
|
73
73
|
"date-fns": "^4.1.0",
|
|
74
74
|
"diff": "5.2.0",
|
|
75
|
-
"fast-querystring": "^1.1.
|
|
75
|
+
"fast-querystring": "^1.1.2",
|
|
76
76
|
"hasha": "^6.0.0",
|
|
77
77
|
"http-errors": "^2.0.0",
|
|
78
78
|
"json5": "^2.2.3",
|