Skip to content

Commit 6cbdf2d

Browse files
chore(npm): update dependency undici to v6.14.1 (#807)
* chore(npm): update dependency undici to v6.14.1 * chore: fix types for undici v6.7.0 * related: nodejs/undici#2708 * chore: fix types for undici v6.12.0 * related: nodejs/undici#3050 --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: 3846masa <[email protected]>
1 parent 53dd11d commit 6cbdf2d

File tree

4 files changed

+23
-17
lines changed

4 files changed

+23
-17
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
"superagent": "9.0.1",
9696
"tough-cookie": "4.1.3",
9797
"typescript": "5.4.5",
98-
"undici": "6.6.2",
98+
"undici": "6.14.1",
9999
"urllib": "3.24.0"
100100
},
101101
"peerDependencies": {

pnpm-lock.yaml

Lines changed: 7 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/undici/cookie_handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class CookieHandler implements Required<Dispatcher.DispatchHandlers> {
4040
this[kHandlers].onUpgrade?.(statusCode, headers, socket);
4141
};
4242

43-
onHeaders = (statusCode: number, _headers: string[] | null, resume: () => void, statusText: string): boolean => {
43+
onHeaders = (statusCode: number, _headers: Buffer[], resume: () => void, statusText: string): boolean => {
4444
if (this[kHandlers].onHeaders == null) {
4545
throw new errors.InvalidArgumentError('invalid onHeaders method');
4646
}

src/undici/utils/convert_to_headers_object.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,17 @@
22
import { errors } from 'undici';
33
import type { IncomingHttpHeaders } from 'undici/types/header';
44

5+
function isIterable(value: unknown): value is Iterable<unknown> {
6+
return typeof value === 'object' && value != null && Symbol.iterator in value;
7+
}
8+
59
function convertToHeadersObject(
6-
_headers: IncomingHttpHeaders | (string | Buffer)[] | null | undefined,
10+
_headers:
11+
| IncomingHttpHeaders
12+
| (string | Buffer)[]
13+
| Iterable<[string, string | string[] | undefined]>
14+
| null
15+
| undefined,
716
): IncomingHttpHeaders {
817
const headers: IncomingHttpHeaders = {};
918

@@ -27,6 +36,10 @@ function convertToHeadersObject(
2736
}
2837
}
2938
}
39+
} else if (isIterable(_headers)) {
40+
for (const [key, value] of _headers) {
41+
headers[key.toLowerCase()] = value;
42+
}
3043
} else if (_headers != null) {
3144
for (const [key, value] of Object.entries(_headers)) {
3245
headers[key.toLowerCase()] = value;

0 commit comments

Comments
 (0)