TibiaData / tibiadata-api-go

TibiaData API written in Golang and deployed in container (version v3 and above).
https://api.tibiadata.com
MIT License
81 stars 28 forks source link

Wrong code status in "Character" and "World" endpoints #311

Open kamiljanek opened 8 months ago

kamiljanek commented 8 months ago
  1. Request /v4/world/{name} with not existing world return status code 400(Bad Request) instead of 404(Not Found) e.g. "https://api.tibiadata.com/v4/world/Anticaa" return:

    {
    "information": {
    "api": {
      "version": 4,
      "release": "4.0.2",
      "commit": "ced9b5f8c1929c079756998f37a0f560bc643c2d"
    },
    "timestamp": "2024-01-09T11:09:50Z",
    "status": {
      "http_code": 400,
      "error": 11002,
      "message": "the provided world does not exist"
    }
    }
    }
  2. Request /v4/character/{name} with not existing character return status code 502(Bad Gateway) instead of 404(Not Found) e.g. "https://api.tibiadata.com/v4/character/Trollefara" return:

    {
    "information": {
    "api": {
      "version": 4,
      "release": "4.0.2",
      "commit": "ced9b5f8c1929c079756998f37a0f560bc643c2d"
    },
    "timestamp": "2024-01-09T11:11:31Z",
    "status": {
      "http_code": 502,
      "error": 20001,
      "message": "could not find character"
    }
    }
    }
tobiasehlert commented 7 months ago

hi @kamiljanek,

thanks for the issue and yes, that return code is not the ideal one for the two endpoints.

@phenpessoa created #309 which did cover a change, but since the change is a breaking change I postpone this for a release of an upcoming version (maybe closer to summer or so).

Kind regards, Tobias

kamiljanek commented 7 months ago

hi @kamiljanek,

thanks for the issue and yes, that return code is not the ideal one for the two endpoints.

@phenpessoa created #309 which did cover a change, but since the change is a breaking change I postpone this for a release of an upcoming version (maybe closer to summer or so).

Kind regards, Tobias

good to know :) thanks