diff --git a/README.md b/README.md index c869d0b..7284b1c 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ Insomnia Mockbin is maintained by [Kong](https://github.com/Kong), who also main - [Running with Docker Compose](#running-with-docker-compose) - [Documentation](#documentation) - [API Docs](#api-docs) + - [Releasing](#releasing) - [Software Bill of materials](#software-bill-of-materials) - [Verify a container image signature](#verify-a-container-image-signature) - [Verify a container image provenance](#verify-a-container-image-provenance) @@ -77,6 +78,16 @@ docker compose up Read the full API documentation, please review the [API Docs](https://github.com/Kong/mockbin/tree/master/docs). +## Releasing + +Run the following command and push the newly created commit into your PR. +This will bump commit and tag, you will need to push this to the remote, which trigger the release action upon merging the PR. + +```sh +npm version patch +git push origin tag +``` + ### Software Bill of materials Kong Insomnia Mockbin produces SBOMs for the below categories: diff --git a/lib/index.js b/lib/index.js index a7354c3..ec9ff6d 100644 --- a/lib/index.js +++ b/lib/index.js @@ -6,14 +6,6 @@ const routes = require("./routes"); module.exports = function (options) { const router = express.Router(); - const defaults = [ - mw.errorHandler, - mw.bodyParser, - mw.cors, - mw.poweredBy, - mw.negotiateContent, - ]; - const endpoints = [ { action: "get", path: "/", route: routes.hello }, { action: "all", path: "/ip", route: routes.ips.one }, @@ -38,11 +30,18 @@ module.exports = function (options) { ]; endpoints.forEach((endpoint) => { - // add route to middleware - defaults.splice(3, 1, endpoint.route); - // assign router to action at path - router[endpoint.action].apply(router, [endpoint.path].concat(defaults)); + router[endpoint.action].apply( + router, + [endpoint.path].concat([ + mw.errorHandler, + mw.bodyParser, + endpoint.route, + mw.cors, + mw.poweredBy, + mw.negotiateContent, + ]), + ); }); if (options?.redis) { diff --git a/lib/routes/bins.js b/lib/routes/bins.js index 668ac50..ba09079 100644 --- a/lib/routes/bins.js +++ b/lib/routes/bins.js @@ -29,14 +29,6 @@ module.exports = function bins(dsnStr) { const router = express.Router(); - const defaults = [ - mw.errorHandler, - mw.bodyParser, - null, - mw.cors, - mw.negotiateContent, - ]; - const endpoints = [ { action: "get", path: "/create", route: routes.form }, { @@ -69,11 +61,17 @@ module.exports = function bins(dsnStr) { ]; endpoints.forEach((endpoint) => { - // add route to middleware - defaults.splice(3, 1, endpoint.route); - // assign router to action at path - router[endpoint.action].apply(router, [endpoint.path].concat(defaults)); + router[endpoint.action].apply( + router, + [endpoint.path].concat([ + mw.errorHandler, + mw.bodyParser, + endpoint.route, + mw.cors, + mw.negotiateContent, + ]), + ); }); return router; diff --git a/package-lock.json b/package-lock.json index 36d4eb5..4cfa537 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "mockbin", - "version": "2.0.1", + "version": "2.0.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "mockbin", - "version": "2.0.1", + "version": "2.0.2", "license": "MIT", "dependencies": { "@idio/dicer": "1.1.0", diff --git a/package.json b/package.json index aa5b8d0..71e41ba 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "2.0.1", + "version": "2.0.2", "name": "mockbin", "description": "Test, mock, and track HTTP requests & responses between libraries, sockets and APIs", "author": "Kong (https://www.konghq.com/)",