Skip to content

Commit 102de6d

Browse files
committed
fix: isResponse correctly asserts even if body is null
1 parent 86c28d1 commit 102de6d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/common.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,11 @@ export type Response = readonly [body: ResponseBody | null, init: ResponseInit];
104104
*/
105105
export function isResponse(val: unknown): val is Response {
106106
// TODO: make sure the contents of init match ResponseInit
107-
return Array.isArray(val) && typeof val[0] === 'string' && isObject(val[1]);
107+
return (
108+
Array.isArray(val) &&
109+
(typeof val[0] === 'string' || val[0] === null) &&
110+
isObject(val[1])
111+
);
108112
}
109113

110114
/**

0 commit comments

Comments
 (0)