Skip to content

Commit d1ee3de

Browse files
committed
refactor(handler): response val must be string or null
Follow-up fix from #127
1 parent 2187f0d commit d1ee3de

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/handler.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export type Response = readonly [body: ResponseBody | null, init: ResponseInit];
120120
function isResponse(val: unknown): val is Response {
121121
// Make sure the contents of body match string | null
122122
if (!Array.isArray(val)) return false;
123-
if (typeof val[0] !== 'string' || val[0] !== null) return false;
123+
if (typeof val[0] !== 'string' && val[0] !== null) return false;
124124
if (!isObject(val[1])) return false;
125125

126126
// Make sure the contents of init match ResponseInit

tests/handler.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ it.each(['schema', 'context', 'onSubscribe', 'onOperation'])(
88
async (option) => {
99
const { request } = createTHandler({
1010
[option]: () => {
11-
return [null, { status: 418 }];
11+
return [null, { status: 418, statusText: '' }];
1212
},
1313
});
1414

0 commit comments

Comments
 (0)