Comparing version 2.6.3 to 2.7.0
# restify Changelog | ||
## 2.6.4 (not yet released) | ||
## not yet released | ||
## 2.7.0 | ||
- #547 Added mapFiles option to bodyParser | ||
- #552 PUT JsonClient test should use PUT not POST | ||
- #550 Make router preflight code more readable | ||
- #548 Allow custom handling of multipart data. | ||
## 2.6.3 | ||
@@ -6,0 +13,0 @@ |
@@ -43,2 +43,11 @@ // Copyright 2012 Mark Cavage, Inc. All rights reserved. | ||
form.onPart = function onPart(part) { | ||
if (part.filename && options.multipartFileHandler) | ||
options.multipartFileHandler(part, req); | ||
else if (!part.filename && options.multipartHandler) | ||
options.multipartHandler(part, req); | ||
else | ||
form.handlePart(part); | ||
}; | ||
form.parse(req, function (err, fields, files) { | ||
@@ -60,17 +69,19 @@ if (err) | ||
Object.keys(files).forEach(function (f) { | ||
if (req.params[f] && !override) | ||
return (false); | ||
var fs = require('fs'); | ||
return fs.readFile( | ||
files[f].path, | ||
'utf8', | ||
function (ex, data) { | ||
if (ex) { | ||
return (false); | ||
} | ||
req.params[f] = data; | ||
return (true); | ||
}); | ||
}); | ||
if (options.mapFiles) { | ||
Object.keys(files).forEach(function (f) { | ||
if (req.params[f] && !override) | ||
return (false); | ||
var fs = require('fs'); | ||
return fs.readFile( | ||
files[f].path, | ||
'utf8', | ||
function (ex, data) { | ||
if (ex) { | ||
return (false); | ||
} | ||
req.params[f] = data; | ||
return (true); | ||
}); | ||
}); | ||
} | ||
} | ||
@@ -77,0 +88,0 @@ |
@@ -415,2 +415,8 @@ // Copyright 2012 Mark Cavage, Inc. All rights reserved. | ||
//Checks if header is in cors.ALLOWED_HEADERS | ||
function inAllowedHeaders(header) { | ||
header = header.toLowerCase(); | ||
return (cors.ALLOW_HEADERS.indexOf(header) !== -1); | ||
} | ||
// This is a very generic preflight handler - it does | ||
@@ -431,11 +437,5 @@ // not handle requiring authentication, nor does it do | ||
// Last, check request-headers | ||
var ok = true; | ||
/* JSSTYLED */ | ||
(headers || '').split(/\s*,\s*/).forEach(function (h) { | ||
if (!h) | ||
return; | ||
var ok = !headers || headers.split(/\s*,\s*/).every(inAllowedHeaders); | ||
h = h.toLowerCase(); | ||
ok = cors.ALLOW_HEADERS.indexOf(h) !== -1 && ok; | ||
}); | ||
if (!ok) | ||
@@ -442,0 +442,0 @@ return (false); |
@@ -36,3 +36,3 @@ { | ||
"description": "REST framework", | ||
"version": "2.6.3", | ||
"version": "2.7.0", | ||
"repository": { | ||
@@ -50,3 +50,3 @@ "type": "git", | ||
"engines": { | ||
"node": ">=0.8" | ||
"node": ">=0.10" | ||
}, | ||
@@ -53,0 +53,0 @@ "dependencies": { |
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
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
177860
4608