Skip to content

Conversation

@YoelPLG
Copy link

@YoelPLG YoelPLG commented Dec 12, 2023

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:

if err != nil {

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:

Screenshot 2023-12-12 at 13 56 24

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@tobiasehlert tobiasehlert added bug Something isn't working enhancement New feature or request good first issue Good for newcomers go Pull requests that update Go code labels Dec 12, 2023
@tobiasehlert tobiasehlert self-assigned this Dec 12, 2023
@tobiasehlert
Copy link
Member

Great PR @YoelPLG, thanks! 🌟
I'll go merge #301 instead since it's covering the same fix plus tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request go Pull requests that update Go code good first issue Good for newcomers

Development

Successfully merging this pull request may close these issues.

2 participants