Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch is not a complete implementation #36

Open
MercerK opened this issue Aug 29, 2022 · 1 comment
Open

Fetch is not a complete implementation #36

MercerK opened this issue Aug 29, 2022 · 1 comment

Comments

@MercerK
Copy link
Contributor

MercerK commented Aug 29, 2022

When looking into fetch, it doesn't seem to be a complete feature. It barely functions, if that.

There is core.fetch that accepts a single parameter. I'm assuming it only defaults to GET and nothing more.

  • How do you customize this?
  • How do you select different methods, like GET, POST, etc?
  • How do you add headers?
  • How do you follow redirects?

Oddly enough, fetch doesn't work the way you expect it to. Fetch doesn't do anything other than creating an object. If you want to do something with fetch, you need to do fetch().json() or fetch().read(), which goes against the grain of expectation when working with fetch on JavaScript.

The other portion is async. I'm not sure how you are supposed to do async with fetch and have it work. It seems to pass it off into a desync object, which tries to get another context to run it. But I believe this is failing as it expects async.js to exist and depending on how folks build their environment, that file may not exist on prod.

Then there is error handling.

[22:45:06 WARN]: An error occured while attempting to execute a task!  
[22:45:06 WARN]: Server returned HTTP response code: 400 for URL: http://localhost:3000

How do we handle errors correctly in this case? It seems to be only throwing a string and not the key object we need to work off of.

I tried implementing my own at the JS level and so far, that fails fairly early on due to HttpRequest.newBuilder().uri(new URI(uri)).

When looking at the sister library, I found this:

As this isn't feature complete, I'm worried that this is creating a blocker for other developers, as they can't do even basic functionality with fetch.

@ghost
Copy link

ghost commented Sep 12, 2022

This is yet another reason why "grakkit/stdlib" isn't an ideal standard. And that's coming from me, the person who made it. Hindsight definitely giving me some 20/20 vision right now. Fetch is probably the least well-implemented function in the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant