koajs / cors

Cross-Origin Resource Sharing(CORS) for koa
Other
732 stars 80 forks source link

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

Closed Nighthawk14 closed 8 years ago

Nighthawk14 commented 8 years ago

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!

dead-horse commented 8 years ago

what version of koa and kcors are you using?

Nighthawk14 commented 8 years ago

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.

dead-horse commented 8 years ago

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

Nighthawk14 commented 8 years ago

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