diff --git a/package-lock.json b/package-lock.json index 93e01f78..7c7115a2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@mojaloop/central-services-shared", - "version": "10.4.3", + "version": "10.4.4", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -948,7 +948,6 @@ "sinon": "9.0.2", "traceparent": "1.0.0", "tslib": "2.0.0", - "uuid4": "1.1.4", "winston": "3.2.1" }, "dependencies": { @@ -5856,9 +5855,9 @@ "integrity": "sha1-+M33eISCb+Tf+T46nMN7HkSAdC4=" }, "openapi-backend": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/openapi-backend/-/openapi-backend-3.5.0.tgz", - "integrity": "sha512-KXo23yI6TE2kJTU9p+WMkK8eROvH1txIZOjCYRBvdXblJQHlfW7PoPPY8eUlw9suyFJz/r4h+pJSRwKQDZ5p1g==", + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/openapi-backend/-/openapi-backend-3.5.1.tgz", + "integrity": "sha512-aVScBkutF280uC4OouZkUThy58Ot3dk2K1HIll9zNsi1If0paU5enwTZKUkLQybSWkvq1MATddz5uz7J4h/sOg==", "requires": { "ajv": "^6.10.0", "bath-es5": "^3.0.3", @@ -7894,9 +7893,10 @@ "dev": true }, "uuid4": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/uuid4/-/uuid4-1.1.4.tgz", - "integrity": "sha512-Gr1q2k40LpF8CokcnQFjPDsdslzJbTCTBG5xQIEflUov431gFkY5KduiGIeKYAamkQnNn4IfdHJbLnl9Bib8TQ==" + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/uuid4/-/uuid4-2.0.2.tgz", + "integrity": "sha512-TzsQS8sN1B2m9WojyNp0X/3JL8J2RScnrAJnooNPL6lq3lA02/XdoWysyUgI6rAif0DzkkWk51N6OggujPy2RA==", + "dev": true }, "v8-compile-cache": { "version": "2.1.0", diff --git a/package.json b/package.json index 0de0c88f..6e2daedc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mojaloop/central-services-shared", - "version": "10.4.3", + "version": "10.4.4", "description": "Shared code for central services", "main": "src/index.js", "scripts": { @@ -56,7 +56,7 @@ "immutable": "3.8.2", "lodash": "4.17.15", "mustache": "4.0.1", - "openapi-backend": "3.5.0", + "openapi-backend": "3.5.1", "raw-body": "2.4.1" }, "devDependencies": { @@ -77,7 +77,7 @@ "tap-xunit": "2.4.1", "tape": "5.0.1", "tapes": "4.1.0", - "uuid4": "1.1.4" + "uuid4": "2.0.2" }, "standard": { "ignore": [] diff --git a/src/util/hapi/plugins/headerValidation.js b/src/util/hapi/plugins/headerValidation.js index 148c77d7..93434057 100644 --- a/src/util/hapi/plugins/headerValidation.js +++ b/src/util/hapi/plugins/headerValidation.js @@ -6,7 +6,7 @@ // accuracy of this statement has not been thoroughly tested. const { Factory: { createFSPIOPError }, Enums } = require('@mojaloop/central-services-error-handling') -const { parseAcceptHeader, parseContentTypeHeader, protocolVersions } = require('../../headerValidation') +const { parseAcceptHeader, parseContentTypeHeader, protocolVersions, protocolVersionsMap } = require('../../headerValidation') // Some defaults @@ -94,7 +94,10 @@ const plugin = { if (!supportedProtocolVersions.includes(contentType.version)) { throw createFSPIOPError( Enums.FSPIOPErrorCodes.UNACCEPTABLE_VERSION, - errorMessages.SUPPLIED_VERSION_NOT_SUPPORTED + errorMessages.SUPPLIED_VERSION_NOT_SUPPORTED, + null, + null, + protocolVersionsMap ) } diff --git a/src/util/headerValidation/index.js b/src/util/headerValidation/index.js index 55b73943..3da553ef 100644 --- a/src/util/headerValidation/index.js +++ b/src/util/headerValidation/index.js @@ -4,9 +4,14 @@ const assert = require('assert').strict const protocolVersions = { anyVersion: Symbol('Any version'), - ONE: ['1', '1.0'] + ONE: ['1', '1.0', '1.1'] } +const protocolVersionsMap = [ + { key: '1', value: '0' }, + { key: '1', value: '1' } +] + // Some convenience functions for generating regexes for header matching const generateContentTypeRegex = resource => @@ -62,6 +67,7 @@ const parseAcceptHeader = (resource, header) => { module.exports = { protocolVersions, + protocolVersionsMap, generateAcceptRegex, generateContentTypeRegex, parseAcceptHeader,