Skip to content

Commit d969942

Browse files
author
Andras Toth
committed
fix(koa): fix koa middleware
1 parent 1446f89 commit d969942

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/koa/koa.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ export default function middleware({ graphiql = true, schema = required() } = {}
2323
}
2424

2525
if (isGet(this) && query && query.includes('mutation')) {
26-
this.status = 406;
27-
this.body = 'GraphQL mutation only allowed in POST request.';
28-
return this.body;
26+
this.throw(406, 'GraphQL mutation only allowed in POST request.');
2927
}
3028

3129
let parsedVariables = variables;
@@ -39,6 +37,6 @@ export default function middleware({ graphiql = true, schema = required() } = {}
3937
return this.body;
4038
}
4139

42-
return next;
40+
return yield next;
4341
};
4442
}

0 commit comments

Comments
 (0)