зеркало из https://github.com/mozilla/makedrive.git
Fix Issues #42 - Add Allow CORS to /api/sync
This commit is contained in:
Родитель
eda3470090
Коммит
e78e94d10d
|
@ -1,8 +1,7 @@
|
|||
---
|
||||
before_script:
|
||||
- "npm install -g grunt-cli"
|
||||
env:
|
||||
- "PORT=3000 NODE_ENV=\"development\" ENABLE_GELF_LOGS=false SESSION_SECRET=\"secret value\" FORCE_SSL=false LOGIN_SERVER_URL_WITH_AUTH=\"http://localhost:3000\""
|
||||
- "PORT=3000 NODE_ENV=\"development\" ENABLE_GELF_LOGS=false SESSION_SECRET=\"secret value\" FORCE_SSL=false LOGIN_SERVER_URL_WITH_AUTH=\"http://localhost:3000\""
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
- "0.10"
|
||||
before_script:
|
||||
- npm install -g grunt-cli
|
||||
|
|
|
@ -24,14 +24,14 @@
|
|||
"dependencies": {
|
||||
"MD5": "^1.2.1",
|
||||
"async": "^0.9.0",
|
||||
"bower": "^1.3.7",
|
||||
"bower": "1.3.8",
|
||||
"browser-request": "^0.3.1",
|
||||
"busboy": "^0.2.6",
|
||||
"crypto-js": "^3.1.2-3",
|
||||
"cryptojs": "^2.5.3",
|
||||
"events": "^1.0.1",
|
||||
"express": "3.4.5",
|
||||
"filer": "0.0.13",
|
||||
"filer": "0.0.14",
|
||||
"filer-fs": "git://github.com/humphd/filer-fs.git#master",
|
||||
"filer-s3": "0.0.2",
|
||||
"formidable": "^1.0.14",
|
||||
|
|
|
@ -30,7 +30,7 @@ module.exports = function createRoutes( app, webmakerAuth ) {
|
|||
server.handle(path, res);
|
||||
});
|
||||
|
||||
app.get( "/api/sync", middleware.authenticationHandler, function( req, res ) {
|
||||
app.get( "/api/sync", middleware.crossOriginHandler, middleware.authenticationHandler, function( req, res ) {
|
||||
var username = req.params.username;
|
||||
var id = req.params.sessionId;
|
||||
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
var expect = require('chai').expect;
|
||||
var request = require('request');
|
||||
|
||||
describe('[HTTP route tests]', function() {
|
||||
it('should allow CORS access to /api/sync route', function(done) {
|
||||
request.get('http://localhost:9090/api/sync', function(req, res, body) {
|
||||
expect(res.headers['access-control-allow-origin']).to.be.eql('*');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
Загрузка…
Ссылка в новой задаче