Comparing version 0.2.6 to 0.2.7
@@ -195,2 +195,22 @@ var util = require('./util'); | ||
/** Hack from https://github.com/mcavage/node-restify/issues/284, until we switch to express */ | ||
function unknownMethodHandler(req, res) { | ||
if (req.method.toLowerCase() === 'options') { | ||
var allowHeaders = ['Accept', 'Accept-Version', 'Content-Type', 'Api-Version']; | ||
if (res.methods.indexOf('OPTIONS') === -1) res.methods.push('OPTIONS'); | ||
res.header('Access-Control-Allow-Credentials', true); | ||
res.header('Access-Control-Allow-Headers', allowHeaders.join(', ')); | ||
res.header('Access-Control-Allow-Methods', res.methods.join(', ')); | ||
res.header('Access-Control-Allow-Origin', req.headers.origin); | ||
return res.send(204); | ||
} else { | ||
return res.send(new restify.MethodNotAllowedError()); | ||
} | ||
} | ||
this._app.on('MethodNotAllowed', unknownMethodHandler); | ||
// Retrieve guaranteed random ID. | ||
@@ -197,0 +217,0 @@ this._app.get(this._options.path + ':key/id', function(req, res, next) { |
@@ -43,3 +43,3 @@ | ||
res.setHeader('Access-Control-Allow-Origin', '*'); | ||
res.setHeader('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE'); | ||
res.setHeader('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS'); | ||
res.setHeader('Access-Control-Allow-Headers', 'Content-Type'); | ||
@@ -46,0 +46,0 @@ |
{ | ||
"name": "peer", | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"description": "PeerJS server component", | ||
@@ -5,0 +5,0 @@ "main": "lib/server.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27282
12
652
1