java
java copied to clipboard
HTTP errors are not handled and result in cache poisoning
In BaseRequest, the only response code handled is 429 (Rate Limit).
Any other code are just ignored and an empty result is returned. If a cache defined, it will poisoning it with an empty value.
If the token is incorrect (or the service has not been renewed on time) will result in silent errors. Same if your service has a glitch and return 5xx error.
As I expect the service would always return 200 in case of success (I assume it will not return 302 or any partial response), any non 200 code could return null and not be stored in the cache.
"Expected" errors like 403 could raise their own exception - probably same for 5xx. I would also add some logging in there.