status_code = self.code return response class Unauthorized(Result): def __init__(self, code=401, error_code=401000, msg="访问未授权!", data=None): super(Unauthorized, self).__init__(code, error_code, msg, data) 就是说,假设要给某个结果的status_code打上401,那我给返回数据中的code...
HTTP_405_METHOD_NOT_ALLOWED = 405 # 客户端请求中的方法被禁止 HTTP_406_NOT_ACCEPTABLE = 406 # 服务器无法根据客户端请求的内容特性完成请求 HTTP_407_PROXY_AUTHENTICATION_REQUIRED = 407 # 此代码类似于401(未授权),但表示客户端必须首先使用代理进行身份验证。 HTTP_408_REQUEST_TIMEOUT = 408 # 请求...
HTTP_405_METHOD_NOT_ALLOWED = 405 # 客户端请求中的方法被禁止 HTTP_406_NOT_ACCEPTABLE = 406 # 服务器无法根据客户端请求的内容特性完成请求 HTTP_407_PROXY_AUTHENTICATION_REQUIRED = 407 # 此代码类似于401(未授权),但表示客户端必须首先使用代理进行身份验证。 HTTP_408_REQUEST_TIMEOUT = 408 # 请求...
* 设置 401 无权限状态 * * @param requestContext */ privatevoidsetUnauthorizedResponse(RequestContextrequestContext,Stringmsg){ requestContext.setSendZuulResponse(false); requestContext.setResponseStatusCode(HttpStatus.UNAUTHORIZED.value()); ResultVOvo=newResultVO(); vo.setCode(401); vo.setMsg(msg);...
/** * 设置 401 无权限状态 * * @param requestContext */ private void setUnauthorizedResponse(RequestContext requestContext, String msg) { requestContext.setSendZuulResponse(false); requestContext.setResponseStatusCode(HttpStatus.UNAUTHORIZED.value()); ResultVO vo = new ResultVO(); vo.setCode(401...
/** * 设置 401 无权限状态 * * @param requestContext */ private void setUnauthorizedResponse(RequestContext requestContext, String msg) { requestContext.setSendZuulResponse(false); requestContext.setResponseStatusCode(HttpStatus.UNAUTHORIZED.value()); ResultVO vo = new ResultVO(); vo.setCode(40...