YUKI Hiroshi
null+****@clear*****
Fri Oct 17 13:31:04 JST 2014
YUKI Hiroshi 2014-10-17 13:31:04 +0900 (Fri, 17 Oct 2014) New Revision: 4d80ef39cb81d14543162f9712034b20bdc333a8 https://github.com/droonga/express-droonga/commit/4d80ef39cb81d14543162f9712034b20bdc333a8 Message: Update usage of express's APIs for express 4.9.x Modified files: lib/adapter/api/groonga/loader.js lib/adapter/http.js lib/middleware/cache-statistics/index.js package.json test/adapter/http.test.js test/express-adapter.test.js test/middleware/cache/middleware.test.js Modified: lib/adapter/api/groonga/loader.js (+1 -1) =================================================================== --- lib/adapter/api/groonga/loader.js 2014-10-17 13:19:04 +0900 (e1a4b0f) +++ lib/adapter/api/groonga/loader.js 2014-10-17 13:31:04 +0900 (09ba8c6) @@ -141,7 +141,7 @@ Loader.prototype._sendResponse = function _sendResponse(body) { } else { httpStatusCode = httpStatusCodes.BAD_REQUEST; } - this._response.jsonp(httpStatusCode, groongaResponse); + this._response.status(httpStatusCode).jsonp(groongaResponse); }; module.exports = Loader; Modified: lib/adapter/http.js (+1 -1) =================================================================== --- lib/adapter/http.js 2014-10-17 13:19:04 +0900 (7f4535d) +++ lib/adapter/http.js 2014-10-17 13:31:04 +0900 (1edd6c0) @@ -30,7 +30,7 @@ function createRequestResponseHandler(params) { if (definition.onResponse) { definition.onResponse(body, response); } else { - response.jsonp(200, body); + response.status(200).jsonp(body); } } } Modified: lib/middleware/cache-statistics/index.js (+1 -1) =================================================================== --- lib/middleware/cache-statistics/index.js 2014-10-17 13:19:04 +0900 (50a8c71) +++ lib/middleware/cache-statistics/index.js 2014-10-17 13:31:04 +0900 (97a0aa7) @@ -1,5 +1,5 @@ module.exports = function middleware(cache) { return function(request, response, next) { - response.jsonp(200, cache.getStatistics()); + response.status(200).jsonp(cache.getStatistics()); } } Modified: package.json (+1 -1) =================================================================== --- package.json 2014-10-17 13:19:04 +0900 (235e551) +++ package.json 2014-10-17 13:31:04 +0900 (3fcb64c) @@ -36,7 +36,7 @@ "winston": "*" }, "devDependencies": { - "express": ">=4.0", + "express": ">=4.9", "chai": "*", "jsdeferred": "*", "mocha": "*", Modified: test/adapter/http.test.js (+1 -1) =================================================================== --- test/adapter/http.test.js 2014-10-17 13:19:04 +0900 (de7cc17) +++ test/adapter/http.test.js 2014-10-17 13:31:04 +0900 (1bfd984) @@ -55,7 +55,7 @@ suite('HTTP Adapter', function() { connection.emit('adapter', 'adapter requested'); }, onResponse: function(data, response) { - response.jsonp(200, 'adapter OK'); + response.status(200).jsonp('adapter OK'); } }) }; Modified: test/express-adapter.test.js (+1 -1) =================================================================== --- test/express-adapter.test.js 2014-10-17 13:19:04 +0900 (06a176a) +++ test/express-adapter.test.js 2014-10-17 13:31:04 +0900 (d3df592) @@ -16,7 +16,7 @@ suite('Adaption for express application', function() { connection.emit('api', 'api requested'); }, onResponse: function(data, response) { - response.jsonp(200, 'api OK'); + response.status(200).jsonp('api OK'); } }) }; Modified: test/middleware/cache/middleware.test.js (+16 -16) =================================================================== --- test/middleware/cache/middleware.test.js 2014-10-17 13:19:04 +0900 (4288bb3) +++ test/middleware/cache/middleware.test.js 2014-10-17 13:31:04 +0900 (2aec2e8) @@ -53,7 +53,7 @@ suite('middleware - cache -', function() { test('non-GET requests', function(done) { application.post('/cache-target/path', function(request, response) { - response.send(200, 'POST - success'); + response.status(200).send('POST - success'); }); client(application) .post('/cache-target/path') @@ -73,7 +73,7 @@ suite('middleware - cache -', function() { test('not matched', function(done) { application.get('/not-cache-target/path', function(request, response) { - response.send(200, 'GET - success'); + response.status(200).send('GET - success'); }); client(application) .get('/not-cache-target/path') @@ -93,7 +93,7 @@ suite('middleware - cache -', function() { test('matched to a rule', function(done) { application.get('/cache-target/path', function(request, response) { - response.send(200, 'GET - success'); + response.status(200).send('GET - success'); }); client(application) .get('/cache-target/path') @@ -132,7 +132,7 @@ suite('middleware - cache -', function() { ] })); application.get('/cache-target-not-used', function(request, response) { - response.send(200, 'GET - success'); + response.status(200).send('GET - success'); }); client(application) @@ -159,7 +159,7 @@ suite('middleware - cache -', function() { test('cached', function(done) { application.get('/cached/success', function(request, response) { - response.send(200, 'OK'); + response.status(200).send('OK'); }); client(application) .get('/cached/success') @@ -185,7 +185,7 @@ suite('middleware - cache -', function() { var handled = false; application.get('/cached/handled', function(request, response) { handled = true; - response.send(200, 'OK'); + response.status(200).send('OK'); }); client(application) .get('/cached/handled') @@ -221,7 +221,7 @@ suite('middleware - cache -', function() { test('cached headers', function(done) { application.get('/cached/headers', function(request, response) { response.setHeader('X-Custom-Header', 'yes'); - response.send(200, 'OK'); + response.status(200).send('OK'); }); client(application) .get('/cached/headers') @@ -244,7 +244,7 @@ suite('middleware - cache -', function() { test('cached body', function(done) { application.get('/cached/body', function(request, response) { - response.json(200, { value: true }); + response.status(200).json({ value: true }); }); client(application) .get('/cached/body') @@ -280,7 +280,7 @@ suite('middleware - cache -', function() { test('initial access', function(done) { application.get('/cached/initial', function(request, response) { - response.send(200, 'OK'); + response.status(200).send('OK'); }); client(application) .get('/cached/initial') @@ -295,7 +295,7 @@ suite('middleware - cache -', function() { test('error response', function(done) { application.get('/cached/fail', function(request, response) { - response.send(400, 'NG'); + response.status(400).send('NG'); }); client(application) .get('/cached/fail') @@ -318,7 +318,7 @@ suite('middleware - cache -', function() { test('not matched', function(done) { application.get('/fresh', function(request, response) { - response.send(200, 'OK'); + response.status(200).send('OK'); }); client(application) .get('/fresh') @@ -341,7 +341,7 @@ suite('middleware - cache -', function() { test('not GET method', function(done) { application.post('/cached/post', function(request, response) { - response.send(200, 'OK'); + response.status(200).send('OK'); }); client(application) .post('/cached/post') @@ -375,10 +375,10 @@ suite('middleware - cache -', function() { ] })); application.get('/cached/first', function(request, response) { - response.json(200, 'OK'); + response.status(200).json('OK'); }); application.get('/cached/second', function(request, response) { - response.json(200, 'OK'); + response.status(200).json('OK'); }); client(application) .get('/cached/first') @@ -425,7 +425,7 @@ suite('middleware - cache -', function() { ] })); application.get('/cached/expired', function(request, response) { - response.json(200, 'OK'); + response.status(200).json('OK'); }); client(application) .get('/cached/expired') @@ -456,7 +456,7 @@ suite('middleware - cache -', function() { ] })); application.get('/cached/expired', function(request, response) { - response.json(200, 'OK'); + response.status(200).json('OK'); }); client(application) .get('/cached/expired') -------------- next part -------------- HTML����������������������������... 다운로드