Comparing version 0.3.2 to 0.3.3
@@ -5,3 +5,3 @@ module.exports = { | ||
'/resources': './collections/resources', | ||
'/property-types': './collections/property-types' | ||
'/property-types': './collections/property-types', | ||
}; |
@@ -17,3 +17,3 @@ /** | ||
// get the path parts | ||
var parts = url.parse(req.url).pathname.split('/') | ||
var parts = req.parts = url.parse(req.url).pathname.split('/') | ||
, paths = req.paths = [] | ||
@@ -38,2 +38,9 @@ , references = req.references = [] | ||
if (path == '/__dashboard') { | ||
req.resource = { | ||
require: './collections/dashboard', | ||
path: '/__dashboard' | ||
}; | ||
return next(); | ||
} | ||
@@ -51,4 +58,4 @@ // restrict access to internal resources | ||
} | ||
@@ -55,0 +62,0 @@ // first look for a resource at the given path |
@@ -15,18 +15,3 @@ /** | ||
var middleware = function (req, res, next) { | ||
if(req.isRemote) { | ||
// allow cross domain access | ||
res.header("Access-Control-Allow-Origin", '*'); | ||
res.header('Access-Control-Allow-Credentials', 'true'); | ||
res.header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS'); | ||
if(req.method === 'OPTIONS') { | ||
if(req.header('Access-Control-Request-Headers')) { | ||
res.header("Access-Control-Allow-Headers", req.header('Access-Control-Request-Headers') + ', Content-Type'); | ||
} | ||
res.send('OK'); | ||
} else { | ||
next(); | ||
} | ||
} else { | ||
next(); | ||
} | ||
next(); | ||
}; | ||
@@ -39,3 +24,3 @@ | ||
middleware.listen = function (callback) { | ||
var server = this.server = express.createServer(function (req, res, next) { | ||
var server = this.server = middleware.server = express.createServer(function (req, res, next) { | ||
// by default pause the request | ||
@@ -93,2 +78,4 @@ req.pause(); | ||
var hostname = url.hostname || 'localhost'; | ||
process.url = url; | ||
@@ -95,0 +82,0 @@ // remote flag / remote auth |
@@ -38,2 +38,3 @@ // from http://github.com/felixge/node-paperboy | ||
"html":"text/html", | ||
"htm":"text/html", | ||
"ice":"x-conference/x-cooltalk", | ||
@@ -40,0 +41,0 @@ "ico":"image/x-icon", |
{ | ||
"author": "Ritchie Martori", | ||
"name": "deployd", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"repository": { | ||
@@ -9,3 +9,3 @@ "url": "git://github.com/deployd/deployd.git" | ||
"engines": { | ||
"node": ">= 0.6.x" | ||
"node": ">= 0.7.x" | ||
}, | ||
@@ -19,3 +19,4 @@ "main":"index", | ||
"commander": "0.5.x", | ||
"express": "2.5.x" | ||
"express": "2.5.x", | ||
"formidable": "1.0.x" | ||
}, | ||
@@ -22,0 +23,0 @@ "devDependencies": { |
@@ -27,2 +27,3 @@ // Testing Dependencies | ||
sessions = client.use('/sessions') | ||
dashboard = client.use('/__dashboard'); | ||
UserCollection = require('../lib/types').UserCollection | ||
@@ -29,0 +30,0 @@ data = { |
@@ -59,7 +59,10 @@ describe('Resource Actions', function(){ | ||
it('should update a single item', function(done) { | ||
todos.post({title: 'a random todo'}, function (e, t) { | ||
todos.post({title: 'a random todo', completed: true}, function (e, t) { | ||
t.title = 'foobar'; | ||
todos.use('/' + t._id).put(t, function (error, todo) { | ||
todos.use('/' + todo._id).get(function (err) { | ||
expect(t.title).to.equal('foobar'); | ||
todos.use('/' + todo._id).get(function (err, todo) { | ||
expect(todo).to.exist; | ||
expect(todo._id).to.exist; | ||
expect(todo.completed).to.equal(true); | ||
expect(todo.title).to.equal('foobar'); | ||
done(err); | ||
@@ -66,0 +69,0 @@ }) |
@@ -1,23 +0,23 @@ | ||
describe('Cross Domain Support', function(){ | ||
describe('OPTIONS /todo', function(){ | ||
it('should include Access-Control-Allow-Headers', function(done) { | ||
var hdrs = 'GET, POST, PUT, DELETE' | ||
, req = {method: 'OPTIONS', url: todos.url, headers: {'Access-Control-Request-Headers': hdrs}} | ||
; | ||
todos.exec(req, function (err, body, req, res) { | ||
expect(body).to.equal('OK'); | ||
done(err); | ||
}) | ||
}) | ||
}) | ||
describe('* /todos', function(){ | ||
it('should include Access-Control-Allow-* headers', function(done) { | ||
todos.get(function (err, body, req, res) { | ||
expect(res.headers['Access-Control-Allow-Origin'.toLowerCase()]).to.equal('*'); | ||
expect(res.headers['Access-Control-Allow-Methods'.toLowerCase()]).to.equal('GET, POST, PUT, DELETE, OPTIONS'); | ||
expect(res.headers['Access-Control-Allow-Credentials'.toLowerCase()]).to.equal('true'); | ||
done(err); | ||
}) | ||
}) | ||
}) | ||
}) | ||
// describe('Cross Domain Support', function(){ | ||
// describe('OPTIONS /todo', function(){ | ||
// it('should include Access-Control-Allow-Headers', function(done) { | ||
// var hdrs = 'GET, POST, PUT, DELETE' | ||
// , req = {method: 'OPTIONS', url: todos.url, headers: {'Access-Control-Request-Headers': hdrs}} | ||
// ; | ||
// todos.exec(req, function (err, body, req, res) { | ||
// expect(body).to.equal('OK'); | ||
// done(err); | ||
// }) | ||
// }) | ||
// }) | ||
// describe('* /todos', function(){ | ||
// it('should include Access-Control-Allow-* headers', function(done) { | ||
// todos.get(function (err, body, req, res) { | ||
// expect(res.headers['Access-Control-Allow-Origin'.toLowerCase()]).to.equal('*'); | ||
// expect(res.headers['Access-Control-Allow-Methods'.toLowerCase()]).to.equal('GET, POST, PUT, DELETE, OPTIONS'); | ||
// expect(res.headers['Access-Control-Allow-Credentials'.toLowerCase()]).to.equal('true'); | ||
// done(err); | ||
// }) | ||
// }) | ||
// }) | ||
// }) |
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
3518231
63
5290
7
3
21
2
+ Addedformidable@1.0.x