From 82a3375ee40c767897ac9cb77b7b624ae4f31404 Mon Sep 17 00:00:00 2001 From: tickli Date: Thu, 10 Oct 2019 17:21:58 +0800 Subject: [PATCH] feat: support mime type text/json --- bin/proxy/http.route.js | 1 + bin/tsw/util/http/parseBody.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/proxy/http.route.js b/bin/proxy/http.route.js index bc03a41b..34066376 100644 --- a/bin/proxy/http.route.js +++ b/bin/proxy/http.route.js @@ -680,6 +680,7 @@ function doRoute(req, res) { contentType.indexOf('application/x-www-form-urlencoded') > -1 || contentType.indexOf('text/plain') > -1 || contentType.indexOf('application/json') > -1 + || contentType.indexOf('text/json') > -1 ) { parseBody(req, res, function() { return modulePathHandler(); diff --git a/bin/tsw/util/http/parseBody.js b/bin/tsw/util/http/parseBody.js index 4570cfab..c971e487 100644 --- a/bin/tsw/util/http/parseBody.js +++ b/bin/tsw/util/http/parseBody.js @@ -65,7 +65,7 @@ module.exports = function(req, res, next) { } req.body = req.POST; - } else if (contentType.indexOf('application/json') > -1) { + } else if (contentType.indexOf('application/json') > -1 || contentType.indexOf('text/json') > -1 ) { try { req.POST = JSON.parse(req.REQUEST.body);