this post was submitted on 31 Dec 2024
89 points (100.0% liked)
Programming
17752 readers
1027 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities [email protected]
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Curl. Everything you described is not hard to do via scripts. I use it every day for all of my API testing needs. You're also not limited to the features Postman provides.
This is like telling someone who needs a new table saw that they can use a handsaw.
Like sure it works great, but it's going to be a long process getting things done compared to something like postman.
If a person needs to process an entire kitchen worth of lumber, then yes, tablesaw. If, however, a person needs to build one simple box and also learn how the wood fits together and practice their skills, then handsaw.
It does not take long to use curl, not sure what you're talking about. There's not particularly special about what Postman does.
Like what?
I make backends, very complex, yet curl does it all, headers, files, any data, whatever.
Need to test an API? Swagger will help everyone.
You need reproducible tests? Write feature tests.
Need to do many requests to achieve a business goal? Put it into a script. Shell is sufficient for basic needs, use anything that can be interpreted for anything more complex. Though at that point you should have an app to handle distributed states, which is never a fun time.
You want to tell me that Postman/whatever is a replacement for feature tests or Swagger?
Oh hell naw
xh
is a nice modern alternative.What's not modern about curl?
It's almost 30 years old. Not to knock cURL, it's a staple for sure.
HTTPie and
xh
claim to have a more intuitive UX. If the functionality is comparable, I choose tools written in memory-safe languages by default.If being over 30 is "not modern", OK, sure, but that's a bit subjective.
The fuctionality is hardly comparable, cURL supports many protocols. As for memory safety it's trendy and modern but it hardly makes sense to rewrite such a project in a memory-safe language. It's been tried though (for some components) and the project lead's open to that.
https://daniel.haxx.se/docs/curl-vs-httpie.html
Httpie and xh only have a small subset of curl's functionality, and IMO the claims of more intuitive UX is dubious at best. More magical and limiting is what I would say. Httpie in particular is slow as hell, too.
Daniel has a more thorough comparison of features across different alternatives here: https://curl.se/docs/comparison-table.html
How would you test a GraphQL API with curl?
EDIT: Nevermind I just looked it up and I'll just stick with postman for now.
The same way you test any other API. Not really different. I tend to keep my request bodies in separate files organized in folders to keep things tidy.