From 74d4c970696826b1a4d0cc8e35eae5904d91ff8d Mon Sep 17 00:00:00 2001 From: Hookin Date: Fri, 11 Jun 2021 09:59:03 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20parse(body)=20->=20JSON.parse(body);=20?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=20try...catch=20=E8=AF=AD=E5=8F=A5;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/middleware/http.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/middleware/http.ts b/src/middleware/http.ts index fb07ba1..6e5773e 100644 --- a/src/middleware/http.ts +++ b/src/middleware/http.ts @@ -49,7 +49,9 @@ function extend(ctx: Context, isHttpRequest: boolean) { ctx.data = JSON.parse(body) } catch (e) {} } else if (contextType === FORM_TYPE) { - ctx.data = parse(body) + try { + ctx.data = JSON.parse(body) + } catch (e) {} } } } -- Gitee