Closed YoelPLG closed 9 months ago
Kudos, SonarCloud Quality Gate passed!
0 Bugs
0 Vulnerabilities
0 Security Hotspots
0 Code Smells
No Coverage information
0.0% Duplication
Great PR @YoelPLG, thanks! 🌟 I'll go merge #301 instead since it's covering the same fix plus tests.
It would love to help a bit with this issue. I'm running tibiadata in my local, and did some tests to reproduce the issue. I think I know why is it failing and returning empty data. In TibiaDataHTMLDataCollector, when the request to Tibia.com is done, there are some checks on the response http code (case http.StatusForbidden:, case http.StatusFound:). But they are done inside this if clause:
This only will be true in case that there is a network error or a timeout, because this refers to an error from the point of view of Resty, the library.
When Tibia.com throttles and returns 403 forbidden, the err variable is still null, so no http code checks are done.
With this changes, instead of returning a response with empty values, a proper error response is returned: