@bpframework/middleware-koa-cors
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -13,6 +13,6 @@ 'use strict'; | ||
export function setEnable(isEnable) { | ||
exports.setEnable = function setEnable(isEnable) { | ||
global[SYM_ENABLE] = isEnable; | ||
} | ||
export function setCfg(cfg) { | ||
exports.setCfg = function setCfg(cfg) { | ||
@@ -19,0 +19,0 @@ if (cfg.allowHeaders) { |
@@ -10,3 +10,11 @@ 'use strict'; | ||
var afterRoute = require('./afterRoute'); | ||
module.exports = async function (ctx) { | ||
// https://segmentfault.com/a/1190000000709909 | ||
if (ctx.method.toLowerCase() == 'options') { | ||
await afterRoute(ctx); | ||
ctx.response.body = ''; | ||
return false; | ||
} | ||
} |
@@ -34,3 +34,3 @@ { | ||
"name": "@bpframework/middleware-koa-cors", | ||
"version": "0.0.1" | ||
"version": "0.0.2" | ||
} |
6480
131