From 1119a6ab726ea1e3950b20f048ef429826c1a2d1 Mon Sep 17 00:00:00 2001 From: tinyhill Date: Wed, 9 Aug 2017 16:24:39 +0800 Subject: [PATCH] Update request.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 考虑 delete 请求一般响应为 204 No Content,会导致 request 无法被 parse 为 json 格式。 --- src/utils/request.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/request.js b/src/utils/request.js index a660650..7a3d2c8 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -22,7 +22,7 @@ export default async function request(url, options) { checkStatus(response); - const data = await response.json(); + const data = response.status === 204 ? null : await response.json(); const ret = { data,