想在_before中统一检测token,然后返回401状态码,但是好像_before中的return不生效,大家是怎么处理的呢?
_before() {
const httpInfo = this.getHttpInfo();
const methodName = this.getMethodName();
const whiteList = ['login', 'add'];
if (!whiteList.includes(methodName) && !httpInfo.headers.token) {
return {
mpserverlessComposedResponse: true,
statusCode: 401,
};
}
},
0 个回复