fix: request plugin data adaptor error

This commit is contained in:
bac-joker 2021-03-12 19:34:06 +08:00
parent dedd607b3b
commit 3940f238e4

View File

@ -1,7 +1,7 @@
import { isFunction, isObject, isString } from './helpers';
export default async ({ response, responseDataAdaptor }, next) => {
if (isFunction(responseDataAdaptor) && (isObject(response.data) || isString(response.data))) {
if (isFunction(responseDataAdaptor) && response && (isObject(response.data) || isString(response.data))) {
response.data = responseDataAdaptor(response.data);
}
await next();