Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

koa-cors

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-cors - npm Package Compare versions

Comparing version 0.0.11 to 0.0.12

Makefile

26

index.js

@@ -12,4 +12,2 @@ /**

origin: function(req) {
// http://www.w3.org/TR/cors/#supports-credentials
// #3 "The string "*" cannot be used for a resource that supports credentials."
return req.header.origin || '*';

@@ -20,14 +18,10 @@ },

settings = settings || defaults;
return function* cors(next) {
var options = {
origin: settings.origin || defaults.origin,
methods: settings.methods || defaults.methods,
credentials: settings.credentials,
headers: settings.headers,
expose: settings.expose,
maxAge: settings.maxAge
};
/**
* Set options
*
* @type {Object}
*/
var options = settings || defaults;

@@ -43,4 +37,4 @@ if (typeof options.origin === 'function') {

return;
} else if (!options.origin || options.origin === true) {
options.origin = defaults.origin;
} else if (typeof options.origin === 'undefined' || options.origin === true) {
options.origin = defaults.origin(this.request);
}

@@ -79,3 +73,5 @@ this.set('Access-Control-Allow-Origin', options.origin);

*/
if (options.methods.join) {
if (typeof options.methods === 'undefined') {
options.methods = defaults.methods;
} else if (options.methods.join) {
options.methods = options.methods.join(',');

@@ -82,0 +78,0 @@ }

{
"name": "koa-cors",
"version": "0.0.11",
"version": "0.0.12",
"description": "CORS middleware for Koa",

@@ -23,3 +23,9 @@ "main": "index.js",

},
"homepage": "https://github.com/evert0n/koa-cors"
"homepage": "https://github.com/evert0n/koa-cors",
"devDependencies": {
"koa": "^0.6.1",
"chai": "^1.9.1",
"mocha": "^1.19.0",
"superagent": "^0.18.0"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc