Skip to content
This repository has been archived by the owner on Mar 28, 2022. It is now read-only.

Commit

Permalink
Merge pull request #203 from mocks-server/release
Browse files Browse the repository at this point in the history
Release v2.4.0
  • Loading branch information
javierbrea committed Jul 7, 2021
2 parents f5fd158 + da36664 commit 7392271
Show file tree
Hide file tree
Showing 7 changed files with 3,096 additions and 1,133 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Removed
### BREAKING CHANGES

## [2.4.0] - 2021-07-07

### Added
- feat(#201): Parsing of body with content-type application/x-www-form-urlencoded

### Changed
- chore(deps): Update devDependencies

## [2.3.3] - 2021-05-29

### Changed
Expand Down
4,192 changes: 3,072 additions & 1,120 deletions package-lock.json

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mocks-server/core",
"version": "2.3.3",
"version": "2.4.0",
"description": "Pluggable mock server supporting multiple route variants and mocks",
"keywords": [
"mocks",
Expand Down Expand Up @@ -40,9 +40,9 @@
"prepare": "is-ci || husky install"
},
"dependencies": {
"@babel/register": "7.13.16",
"@babel/register": "7.14.5",
"@hapi/boom": "9.1.2",
"ajv": "8.5.0",
"ajv": "8.6.0",
"ajv-errors": "3.0.0",
"body-parser": "1.19.0",
"commander": "7.2.0",
Expand All @@ -58,28 +58,28 @@
"require-all": "3.0.0",
"route-parser": "0.0.5",
"winston": "3.3.3",
"winston-array-transport": "1.1.1"
"winston-array-transport": "1.1.4"
},
"devDependencies": {
"@babel/preset-env": "7.14.4",
"@babel/preset-typescript": "7.13.0",
"@babel/preset-env": "7.14.7",
"@babel/preset-typescript": "7.14.5",
"cross-fetch": "3.1.4",
"cross-spawn": "7.0.3",
"eslint": "7.27.0",
"eslint": "7.29.0",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-no-only-tests": "2.6.0",
"eslint-plugin-prettier": "3.4.0",
"husky": "6.0.0",
"is-ci": "3.0.0",
"jest": "27.0.3",
"jest": "27.0.5",
"lint-staged": "11.0.0",
"prettier": "2.3.0",
"prettier": "2.3.2",
"request": "2.88.2",
"request-promise": "4.2.6",
"sinon": "11.1.1",
"strip-ansi": "6.0.0",
"tree-kill": "1.2.2",
"wait-on": "5.3.0"
"wait-on": "6.0.0"
},
"lint-staged": {
"src/**/*.js": "eslint",
Expand Down
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
sonar.organization=mocks-server
sonar.projectKey=mocks-server_core
sonar.projectVersion=2.3.3
sonar.projectVersion=2.4.0

sonar.javascript.file.suffixes=.js
sonar.sourceEncoding=UTF-8
Expand Down
1 change: 1 addition & 0 deletions src/server/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class Server {
);
}
this._express.use(middlewares.jsonBodyParser);
this._express.use(middlewares.formBodyParser);
this._express.use(middlewares.traceRequest);
this._registerCustomRouters();
this._express.use(this._mocksRouter);
Expand Down
2 changes: 2 additions & 0 deletions src/server/middlewares.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const tracer = require("../tracer");

const addRequestId = expressRequestId();
const jsonBodyParser = bodyParser.json();
const formBodyParser = bodyParser.urlencoded({ extended: true });

const traceRequest = (req, res, next) => {
tracer.verbose(`Request received | ${req.method} => ${req.url} | Assigned id: ${req.id}`);
Expand Down Expand Up @@ -50,6 +51,7 @@ const errorHandler = (err, req, res, next) => {
module.exports = {
addRequestId,
jsonBodyParser,
formBodyParser,
traceRequest,
notFound,
errorHandler,
Expand Down
4 changes: 2 additions & 2 deletions test/unit/server/Server.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,15 @@ describe("Server", () => {
coreInstance.settings.get.withArgs("cors").returns(true);
await server.init();
await server.start();
expect(libsMocks.stubs.express.use.callCount).toEqual(8);
expect(libsMocks.stubs.express.use.callCount).toEqual(9);
});

it("should not add cors middleware if cors option is disabled", async () => {
libsMocks.stubs.http.createServer.onListen.returns(null);
coreInstance.settings.get.withArgs("cors").returns(false);
await server.init();
await server.start();
expect(libsMocks.stubs.express.use.callCount).toEqual(7);
expect(libsMocks.stubs.express.use.callCount).toEqual(8);
});

it("should reject the promise if an error occurs when calling to server listen method", async () => {
Expand Down

0 comments on commit 7392271

Please sign in to comment.