422 Unprocessable Entity

问题原因
登录成功后获取到的token只缓存到内存中,并没有序列化到本地;这种情况下内存回收token丢失后,访问接口就没有传递token才导致的422 Unprocessable Entity;

The HyperText Transfer Protocol (HTTP) 422 Unprocessable Entity response status code indicates that the server understands the content type of the request entity, and the syntax of the request entity is correct, but it was unable to process the contained instructions.

解决办法
登录成功后,应该有一个贯穿App的User全局变量,这个全局变量要支持序列化到本地;在使用时候先从内存中获取,内存中没有再从本地获取(并对内存中赋值);这样数据才不会因为内存回收而丢失;

参考:
状态码

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值