Skip to content

Commit 18fe3a4

Browse files
committed
chore: changes after review
1 parent 446e35b commit 18fe3a4

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

packages/cli/src/commands/respect/connection-client.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,19 @@ export function withConnectionClient(mtlsCerts: MtlsCerts = {}) {
5656
return fetch;
5757
}
5858

59-
return (input: string | URL | RequestInfo, init?: RequestInit) => {
60-
const url = typeof input === 'string' ? input : 'url' in input ? input.url : input.toString();
59+
return (input: RequestInfo, init?: RequestInit) => {
60+
const url =
61+
typeof input === 'string'
62+
? input
63+
: input instanceof URL
64+
? input.toString()
65+
: 'url' in input
66+
? input.url
67+
: undefined;
68+
69+
if (!url) {
70+
throw new Error('Invalid input URL');
71+
}
6172

6273
return fetch(input, {
6374
...init,

0 commit comments

Comments
 (0)