koajs / cors

Cross-Origin Resource Sharing(CORS) for koa

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ctx.throw || ctx.assert doesn't send the headers back

Nighthawk14 opened this issue · comments

When using ctx.throw or ctx.assert the cors headers are not sent back. Maybe I'm using it wrong but any help would be welcome :).

example:

router.post('/', (ctx) => {
  let {name, jurisdiction, parentTitle} = ctx.request.body;
  const project = ctx.request.body;

  ctx.assert(name && jurisdiction && parentTitle, 400);

Thanks!

what version of koa and kcors are you using?

koa@2.0.0-alpha.3 and kcors@2.1.1 :)

On 28 Jul 2016, at 4:47 PM, Yiyu He notifications@github.com wrote:

what version of koa and kcors are you using?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

if you are using default error handler in koa, please update your koa to 2.0.0-beta.4

@dead-horse Thanks for the help, it's definitely better! 😃