From 31b2ca5b118ef4dc9d1bbf20871e2ae022a2b1b6 Mon Sep 17 00:00:00 2001 From: winixt Date: Thu, 13 Jan 2022 19:18:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20request=20response=20=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fes-plugin-request/src/template/resDataAdaptor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fes-plugin-request/src/template/resDataAdaptor.js b/packages/fes-plugin-request/src/template/resDataAdaptor.js index a045f62a..91d3a0f8 100644 --- a/packages/fes-plugin-request/src/template/resDataAdaptor.js +++ b/packages/fes-plugin-request/src/template/resDataAdaptor.js @@ -2,7 +2,7 @@ import { isFunction, isObject, isString } from './helpers'; export default async ({ response, responseDataAdaptor }, next) => { // 如果 data 是 blob 并且 content-type 是 application/json,自动进行数据处理 - if (response.data instanceof Blob && response.headers['content-type'].startsWith('application/json') && response.data.type === 'application/json') { + if (response && response.data instanceof Blob && response.headers['content-type'].startsWith('application/json') && response.data.type === 'application/json') { const rawData = response.data; try { response.data = JSON.parse(await response.data.text());