New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

connect-cors

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect-cors - npm Package Compare versions

Comparing version 0.5.0 to 0.5.1

.npmignore

19

lib/connect-cors.js

@@ -0,5 +1,9 @@

// Generated by CoffeeScript 1.3.3
(function() {
"use strict";
var create, defaultOrigins, defaultResources, defaults, escapeRegExp, isMSIE, msiePattern, operaPattern, selectNotEmpty, url;
url = require("url");
defaults = {

@@ -12,2 +16,3 @@ origins: [],

};
defaultResources = [

@@ -18,5 +23,9 @@ {

];
defaultOrigins = ['*'];
msiePattern = /MSIE/i;
operaPattern = /Opera/i;
isMSIE = function(req) {

@@ -34,2 +43,3 @@ var agent;

};
selectNotEmpty = function(a, b) {

@@ -44,5 +54,7 @@ if (a != null ? a.length : void 0) {

};
escapeRegExp = function(str) {
return str.replace(/[-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
};
create = function(config) {

@@ -67,3 +79,3 @@ var corsHandler;

resourceHandler = function(obj, i) {
var headers, matchOrigin, methods, origins, pattern;
var credentials, headers, matchOrigin, methods, origins, pattern;
pattern = obj.pattern;

@@ -73,2 +85,3 @@ methods = selectNotEmpty(obj.methods, config.methods);

origins = selectNotEmpty(obj.origins, config.origins) || defaultOrigins;
credentials = selectNotEmpty(obj.credentials, config.credentials);
origin = req.headers.origin;

@@ -109,3 +122,3 @@ matchOrigin = function(originPattern, i) {

}
if (typeof credentials !== "undefined" && credentials !== null) {
if (credentials != null) {
res.setHeader('Access-Control-Allow-Credentials', "true");

@@ -135,3 +148,5 @@ }

};
module.exports = create;
}).call(this);

2

package.json

@@ -8,3 +8,3 @@ {

"description": "CORS / XHR2 support for Node.JS's Connect",
"version": "0.5.0",
"version": "0.5.1",
"homepage": "https://github.com/antono/connect-cors",

@@ -11,0 +11,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

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