diff --git a/test/verify-api-key-test.js b/test/verify-api-key-test.js index 1d848d8..fe28b6c 100644 --- a/test/verify-api-key-test.js +++ b/test/verify-api-key-test.js @@ -41,7 +41,7 @@ describe('verify-api-key plugin', () => { } if (body.key === 'INVALID-KEY') { - res.end(JSON.stringify({type: 'ErrorResult', result: {errorCode: "PROVIDED_ERROR_CODE"}})); + res.end(JSON.stringify({type: 'ErrorResult', result: {errorCode: "PROVIDED_ERROR_CODE", reason: "LOL KEY ISNT HERE"}})); } else if (body.key === 'REVOKED-KEY') { res.end(JSON.stringify({result:{status: 'REVOKED'}})) } @@ -112,7 +112,7 @@ describe('verify-api-key plugin', () => { } var res = {proxy: proxy}; var cb = (err, result) => { - assert.equal(err, "PROVIDED_ERROR_CODE"); + assert.equal(err, "LOL KEY ISNT HERE"); assert.equal(res.statusCode, 401); done(); } diff --git a/verify-api-key/index.js b/verify-api-key/index.js index 02f1a72..aedb166 100644 --- a/verify-api-key/index.js +++ b/verify-api-key/index.js @@ -57,9 +57,9 @@ module.exports.init = function(config, logger, stats) { } if (jsonBody.type == 'ErrorResult') { - logger.error(jsonBody.result.errorCode, 'verify-api-key'); + logger.error(jsonBody.result, jsonBody.result.reason, 'verify-api-key'); res.statusCode = 401; - next (jsonBody.result.errorCode); + next (jsonBody.result.reason); } else if (jsonBody.result.status == 'REVOKED') { logger.info('API key has been revoked.', 'verify-api-key');