Skip to content

Commit c3e510f

Browse files
committed
Body parser removed. Fixes #1
1 parent f4153dc commit c3e510f

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## 1.0.3 (2018-01-12)
2+
3+
### Features:
4+
5+
- Body parser removed from cli-connect-mocker. Because from v 1.3.5, connect-api-mocker supports parsing json requests internally.
6+
17
## 1.0.2 (2017-09-08)
28

39
### Features:

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
{
22
"name": "cli-api-mocker",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"description": "CLI wrapper for connect-api-mocker",
55
"main": "src/index.js",
66
"dependencies": {
7-
"body-parser": "^1.17.2",
87
"command-line-args": "^4.0.7",
9-
"connect-api-mocker": "^1.3.1",
8+
"connect-api-mocker": "^1.3.5",
109
"cors": "^2.8.4",
1110
"express": "^4.15.4",
1211
"http-proxy-middleware": "^0.17.4"

src/index.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ try {
5050

5151
app.use(cors())
5252

53-
// TOOD: Multipart request support https://github.com/muratcorlu/cli-api-mocker/issues/1
54-
app.use(bodyParser.json())
55-
5653
for(var path in config.map) {
5754

5855
var conf = config.map[path];
@@ -71,15 +68,6 @@ for(var path in config.map) {
7168
target: conf.proxy
7269
}
7370
}
74-
conf.proxy.onProxyReq = function (proxyReq, req, res, options) {
75-
if(req.body) {
76-
// TOOD: Multipart request support https://github.com/muratcorlu/cli-api-mocker/issues/1
77-
var bodyData = JSON.stringify(req.body);
78-
proxyReq.setHeader('Content-Type','application/json');
79-
proxyReq.setHeader('Content-Length', Buffer.byteLength(bodyData));
80-
proxyReq.write(bodyData);
81-
}
82-
}
8371
app.use(path, proxy(conf.proxy));
8472
}
8573
}

0 commit comments

Comments
 (0)