diff --git a/ghost/extract-api-key/lib/extract-api-key.js b/ghost/extract-api-key/lib/extract-api-key.js index 774fd1da68..29c1dc0996 100644 --- a/ghost/extract-api-key/lib/extract-api-key.js +++ b/ghost/extract-api-key/lib/extract-api-key.js @@ -1,24 +1,16 @@ -/** - * @typedef {object} ApiKey - * @prop {string} key - * @prop {string} type - */ - /** * * @param {import('express').Request} req - * @returns {ApiKey} + * @returns {string} */ const extractAPIKey = (req) => { - let key = null; - let type = null; + let keyValue = null; if (req.query && req.query.key) { - type = 'content'; - key = req.query.key; + keyValue = req.query.key; } - return {key, type}; + return keyValue; }; module.exports = extractAPIKey; diff --git a/ghost/extract-api-key/test/extract-api-key.test.js b/ghost/extract-api-key/test/extract-api-key.test.js index 41ab6c391d..dab7583dbe 100644 --- a/ghost/extract-api-key/test/extract-api-key.test.js +++ b/ghost/extract-api-key/test/extract-api-key.test.js @@ -2,25 +2,23 @@ const assert = require('assert'); const extractApiKey = require('../index'); describe('Extract API Key', function () { - it('returns nulls for a request without any key', function () { - const {key, type} = extractApiKey({ + it('Returns nulls for a request without any key', function () { + const key = extractApiKey({ query: { filter: 'status:active' } }); assert.equal(key, null); - assert.equal(type, null); }); it('Extracts Content API key from the request', function () { - const {key, type} = extractApiKey({ + const key = extractApiKey({ query: { key: '123thekey' } }); assert.equal(key, '123thekey'); - assert.equal(type, 'content'); }); });