Parse body
This commit is contained in:
parent
25f25be78e
commit
cd6aa2ee29
1 changed files with 6 additions and 3 deletions
|
@ -43,7 +43,9 @@ app.use(serveStatic(__dirname + "/content/.vuepress/dist"));
|
||||||
|
|
||||||
app.use(cors());
|
app.use(cors());
|
||||||
|
|
||||||
app.use(bodyParser.text());
|
var textParser = bodyParser.text({
|
||||||
|
limit: '256kb'
|
||||||
|
});
|
||||||
|
|
||||||
app.get('/forward', function(req, res) {
|
app.get('/forward', function(req, res) {
|
||||||
|
|
||||||
|
@ -76,7 +78,7 @@ app.get('/forward', function(req, res) {
|
||||||
qs: req.query
|
qs: req.query
|
||||||
}, function(error, response, body) {
|
}, function(error, response, body) {
|
||||||
// Should we filter the body parameters before forwarding to user?
|
// Should we filter the body parameters before forwarding to user?
|
||||||
body = JSON.parse(body);
|
body = JSON.parse(body);
|
||||||
if(typeof body.error != "undefined") {
|
if(typeof body.error != "undefined") {
|
||||||
logSlackError('ERROR: Got error from daemon: ' + JSON.stringify(body.error));
|
logSlackError('ERROR: Got error from daemon: ' + JSON.stringify(body.error));
|
||||||
}
|
}
|
||||||
|
@ -105,7 +107,7 @@ app.get('/github-feed', function(req, res) {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post('/upload-image', function(req, res) {
|
app.post('/upload-image', textParser, function(req, res) {
|
||||||
|
|
||||||
request({
|
request({
|
||||||
method: "PUT",
|
method: "PUT",
|
||||||
|
@ -115,6 +117,7 @@ app.post('/upload-image', function(req, res) {
|
||||||
},
|
},
|
||||||
body: req.body,
|
body: req.body,
|
||||||
}, function(error, response, body) {
|
}, function(error, response, body) {
|
||||||
|
body = JSON.parse(body);
|
||||||
res.json(body);
|
res.json(body);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue