-
Notifications
You must be signed in to change notification settings - Fork 1
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
superagent vs. node-fetch #53
Comments
The thing I like about fetch over superagent is that it doesn't tie you to the express/connect ecosystem. You could scaffold out a suite of specs for a redbeard-api-compliant server, then go off and build that server in Elixir or Go if you wanted. In the light of day, though, that's probably not that big of a deal. It's simple enough to switch superagent back to fetch if you decide you want to do a thing like that.
Nice! Superagent getting involved in assertion always made me feel icky. I'd be happy to switch from fetch to doubleagent. I'd be a little reticent to switch to raw superagent, though, given the assertion weirdness. |
I don't like But if we need an ajax lib for multiple purposes, then I think I like |
One issue I think i'm about to run into with node-fetch is it doesn't encode query strings for you. You can use another library of course, but most request libraries normally do this for you. |
Hmm kinda sucks you gotta do that yourself :/ |
Or at least it's not documented if it does it for you... Why don't we use Axios like we have before? |
I'm happy with |
It's just for testing in |
ok, a few points.
I guess the real question you need to ask yourself here is whether you'd prefer to have more boilerplate or more magic? that is the whole difference in mindsets here I think. i don't like code generators much. i believe that if a problem is so repetitive that it can be generated over and over again, it should be abstracted. you like i believe that every line of code in a code base (written manually or otherwise) is a maintenance overhead. and that is why i tend to fold everything into abstractions like |
Yep, agreed. It's not a big deal.
ORLY? That's brilliant. Superagent docs all talk about how it's for express/connect apps so I assumed it was using some of the magic they layer on top of
I dreamed a dream where http on the client and server were both exactly the same. Figured it would be a nice reality which is why I started playing with fetch. If people are finding the
Agree doubleagent is a better fit for tests. Application code can use axios, fetch or whatever else depending on needs.
I tend towards minimal magic, but maximal modularity for code reuse. I think we're aligned there.
Absolutely agree there. Every line is something you must carry with you forever. I think what this points out, though, is that we need to sync on "Why is this thing a generator and not a library?". We've got what we think are real good reasons for that, but it would be good to get your input. |
Another thing regarding testing. I've noticed that you use
node-fetch
for hitting your API in tests. Which is great but not nearly as safe and performant as mounting an app in the same process and hitting it through an internal socket as superagent does.Also, not to brag, but i've built a thing called doubleagent which is kind of like superagent but is Promise based through and through and specifically tuned for testing JSON APIs (meaning it does JSON data serialization/deserialization and so on)
and it also decouples the JSON APIs testing from the assertion libraries. so, unlike
superagent
you can use it with whatevers and feel good about your dayThe text was updated successfully, but these errors were encountered: