@nxtedition/nxt-undici 2.0.17 → 2.0.18
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/lib/interceptor/log.js
CHANGED
|
@@ -31,20 +31,20 @@ class Handler {
|
|
|
31
31
|
onRequestSent() {
|
|
32
32
|
const hash = this.hasher?.digest('base64')
|
|
33
33
|
|
|
34
|
-
if (this.
|
|
34
|
+
if (this.length != null && this.pos !== Number(this.length)) {
|
|
35
35
|
this.abort(
|
|
36
36
|
Object.assign(new Error('Request Content-Length mismatch'), {
|
|
37
|
-
expected: this.
|
|
38
|
-
actual:
|
|
37
|
+
expected: Number(this.length),
|
|
38
|
+
actual: this.pos,
|
|
39
39
|
}),
|
|
40
40
|
)
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
if (this.
|
|
43
|
+
if (this.md5 != null && hash !== this.md5) {
|
|
44
44
|
this.abort(
|
|
45
|
-
Object.assign(new Error('Request Content-
|
|
46
|
-
expected:
|
|
47
|
-
actual:
|
|
45
|
+
Object.assign(new Error('Request Content-MD5 mismatch'), {
|
|
46
|
+
expected: this.md5,
|
|
47
|
+
actual: hash,
|
|
48
48
|
}),
|
|
49
49
|
)
|
|
50
50
|
}
|
|
@@ -44,15 +44,6 @@ class Handler {
|
|
|
44
44
|
onComplete(rawTrailers) {
|
|
45
45
|
const hash = this.hasher?.digest('base64')
|
|
46
46
|
|
|
47
|
-
if (this.md5 != null && hash !== this.md5) {
|
|
48
|
-
return this.handler.onError(
|
|
49
|
-
Object.assign(new Error('Request Content-Length mismatch'), {
|
|
50
|
-
expected: this.md5,
|
|
51
|
-
actual: hash,
|
|
52
|
-
}),
|
|
53
|
-
)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
47
|
if (this.length != null && this.pos !== Number(this.length)) {
|
|
57
48
|
return this.handler.onError(
|
|
58
49
|
Object.assign(new Error('Request Content-Length mismatch'), {
|
|
@@ -60,9 +51,16 @@ class Handler {
|
|
|
60
51
|
actual: this.pos,
|
|
61
52
|
}),
|
|
62
53
|
)
|
|
54
|
+
} else if (this.md5 != null && hash !== this.md5) {
|
|
55
|
+
return this.handler.onError(
|
|
56
|
+
Object.assign(new Error('Request Content-MD5 mismatch'), {
|
|
57
|
+
expected: this.md5,
|
|
58
|
+
actual: hash,
|
|
59
|
+
}),
|
|
60
|
+
)
|
|
61
|
+
} else {
|
|
62
|
+
return this.handler.onComplete(rawTrailers)
|
|
63
63
|
}
|
|
64
|
-
|
|
65
|
-
return this.handler.onComplete(rawTrailers)
|
|
66
64
|
}
|
|
67
65
|
|
|
68
66
|
onError(err) {
|