PokeAPI / pokeapi-js-wrapper

PokeAPI browser wrapper, fully async with built-in cache
Mozilla Public License 2.0
277 stars 44 forks source link

A catch that fetches without / at the end #22

Closed LuziferSenpai closed 3 years ago

LuziferSenpai commented 3 years ago

Hey,

it would be nice if there would be a catch after the first fetch, that excludes the / at the end of the fetch url.

Because that causes problems for me since the first minute.

Greetz,

Luzifer

Naramsim commented 3 years ago

Hi, let me understand.

Do you want to add a .catch() immediately after the .fetch()?

Isn't it already there?

https://github.com/PokeAPI/pokeapi-js-wrapper/blob/739a393e58d3d251b6897372a11b5075584a70ec/src/getter.js#L52

LuziferSenpai commented 3 years ago

But it doesnt retry the fetch without the / at the end

Naramsim commented 3 years ago

Ahh, you want the retry! Now I understand

LuziferSenpai commented 3 years ago

Yea, because of I get ALOT of errors that it cant fetch the url with / at the end, when I then open it, it errors too, but when I remove the / it works.

Naramsim commented 3 years ago

I can think about it. I don't have much time though. Don't expect something quick from my side

shinymimiq commented 3 years ago

Proposed a PR for it. #25

Phoenix-Starlight commented 3 months ago

I'm experiencing this issue again, where dropping the slash fixes it. It occurs specifically at this URL https://pokeapi.co/api/v2/pokemon/218/ but not any URL before index 218.

Naramsim commented 3 months ago

hmm, by browsing the URL without the final / you see something ?

Phoenix-Starlight commented 3 months ago

Via the wrapper I do get an object corresponding to the correct data, but if I do not then I simply get ''. Browsing through the browser has the JSON display.