Closed Rekseto closed 1 year ago
Thanks for submitting this, will test it this weekend and try to merge.
bump
Basically, it should be rewrited as i suggested in this post. That would be much easier than creating fake abstract layers, that makes maintaining project much harder.
That is easiest fix for issue - https://github.com/Electroid/mojang-api/issues/35 Its not perfect but it works and makes some sense at certain point.
But to be clear much easier would be not writing useless helpers for HTTP that are changing structure of error handling atm you are not able to check inside of API function from which reason mojang failed and giving positive information (account not found when it is not true is really dangerous for potential users of this API). That's why I provided simple error handling that introduces in response third state - false if response is set to false that means that it failed. response that is null is reasonable when there is no content provided by external API (mojang) but when mojang responds with error (like when it's down) we set response to false to give substitute for proper error handling.
So my recommendation is to accept this PR and in free time work on removing all of these HTTP method (because it just wrapping old & good fetch API) and just rewire your methods to use it proper
I just provided fast draft how I would see it working. That change would improve error handling and reduce amounts of code o maintain leaving everything for fetch API.