News for hackers. Stuff that matters.
Re:Postman Now Supports gRPC by avel on Wednesday February 02, 2022 @10:03AM (#30178495)
As I have also been frustrated with the direction Postman has taken, I have a great alternative to suggest, if the only thing you want to do is fire requests on demand easily and do not need automated testing.

The VS Code Rest Client extension https://marketplace.visualstudio.com/items?itemName=humao.re... is great for testing and debugging APIs.

You create a "my_request.http" file that contains something like

  POST https://example.com/comments HTTP/1.1
  content-type: application/json

  {
    "name": "sample",
    "time": "Wed, 21 Oct 2015 18:27:50 GMT"
  }
First line is the method and url, then headers, then a newline, then the request body.

Hit ctrl+alt+p, the request is sent and you see the response in a side pane. Everything is encoded and decoded properly.

You can organize your tests under multiple files and folders.

I cannot recommend this extension enough, it has made my life so much easier.

Re:Postman Now Supports gRPC by judge2020 on Wednesday February 02, 2022 @10:19AM (#30178740)
Can it do substitution with some sort of application-based KV store? The main reason I used a rest client like Insomnia is so that I can reference secrets like {{ client_secret }} or {{ api_key }} and have a change to the value in the KV store reflect for every request.
Re:Postman Now Supports gRPC by cloudrkt on Wednesday February 02, 2022 @01:12PM (#30181491)
Yes it supports variables, don't know about KV store, see: https://marketplace.visualstudio.com/items?itemName=humao.re...
Re:Postman Now Supports gRPC by nexuist on Wednesday February 02, 2022 @10:39AM (#30179079)
Yes, it seems like it:

"We support two types of variables, one is Custom Variables which is defined by user and can be further divided into Environment Variables, File Variables and Request Variables, the other is System Variables which is a predefined set of variables out-of-box."

However, what I can't figure out is if it supports programmatic variable setting. I have an API where I need to retrieve a token from an endpoint before using it for every other endpoint, and I'm using Postman's test scripts to set that token as an environment variable before sending all the other requests so they can all use it. I don't see a way to replicate that with this extension.

Re:Postman Now Supports gRPC by test-account on Thursday February 03, 2022 @06:02AM (#30190993)
You can do it with intelij
Re:Postman Now Supports gRPC by avel on Wednesday February 02, 2022 @10:31AM (#30178950)
Someone posted https://hurl.dev/ below. It looks like a command-line alternative to this, with a similar format, and support for assertions.
Re:Postman Now Supports gRPC by jicea on Wednesday February 02, 2022 @02:45PM (#30182964)
Hi, one of the maintainer of Hurl [1]. It is effectively basically just curl (we're using libcurl under the hood). I would say that we have added the ability to chain request (you could use curl in a shell script), and a bunch of assert (like jsonpath, xpath etc...) on response (which you could arguably do also with shell script).

We also wanted something text based, that could easily be integrated in a CI [2] for instance. We are using Hurl to test our web application (~2M unique visitors/month). Very happy with it currently, but there are really a lot of very good tools in this space (as we can see in these comments).

[1] https://hurl.dev

[2] https://hurl.dev/docs/tutorial/ci-cd-integration.html

Re:Postman Now Supports gRPC by Cthulhu_ on Thursday February 03, 2022 @03:23AM (#30190036)
I too like this approach, because the format is simple and text-based and you can maintain it in your git repository.

My main gripe with Postman and Insomnia isn't actually the web based UI, but the lock-in. You can't access the files that they store their data in easily. Postman especially tries to push people towards getting their per-seat 'cloud' subscription if you want to share sets of HTTP requests.

But using this text-based REST client, you don't have this file lock-in.

For IntelliJ this feature is actually built in, I believe it uses the same syntax.

Re:Postman Now Supports gRPC by sharat87 on Wednesday February 02, 2022 @09:25PM (#30187668)
Shameless plug: There's also Prestige at https://prestigemad.com, which is very similar but works right in the browser. You can save your files as Gists as well. Templating with variables is also supported with `${}` syntax, like Javascript's template strings.

But gRPC support is not built yet. It's on the roadmap.

Re:Postman Now Supports gRPC by seanw444 on Thursday February 03, 2022 @03:29PM (#30198350)
For you Emacsers that haven't heard of it, the alternative to this https://github.com/pashky/restclient.el

Super straightforward.

Re:Postman Now Supports gRPC by nichos on Wednesday February 02, 2022 @11:57PM (#30188883)
There's also insomnia: http://insomnia.rest/

Which is an open source, cross platform alternative to postman.

Re:Postman Now Supports gRPC by saikatsg on Friday February 04, 2022 @12:22AM (#30203210)
Also, Thunder client is a lightweight REST API client extension for VS Code. Good fit for basic usage requirements.
Re:Postman Now Supports gRPC by halpert on Wednesday February 02, 2022 @10:29AM (#30178922)
Doesn’t curl do this just as easily?
Re:Postman Now Supports gRPC by IshKebab on Wednesday February 02, 2022 @11:16AM (#30179581)
Sounds a lot easier than curl tbh. No need to deal with shell scripts and their insane quoting, plus you get the response straight in your editor with syntax highlighting.
Re:Postman Now Supports gRPC by halpert on Wednesday February 02, 2022 @12:27PM (#30180739)
Maybe it’s just me but I’ve never had those issues. Another benefit of curl is that you have an easily searchable history of every command you’ve run. So you can easily find old invocations and rerun them.
Re:Postman Now Supports gRPC by avel on Wednesday February 02, 2022 @01:42PM (#30181939)
This extension also keeps a history of requests.

How complicated are your requests? If I need to test a POST request with a JSON payload longer than a line or two, I'll go and construct my curl command in a text editor anyway, since the shell prompt / readline is not easy to edit. Once you need to start escaping single or double quotes or html payloads in the request, it quickly gets cumbersome. At that point I ditch the shell as a middleman and use the editor to submit the request for me.

Re:Postman Now Supports gRPC by halpert on Wednesday February 02, 2022 @02:53PM (#30183071)
You can have curl read the request body from a file using --data @filename.txt.
Re:Postman Now Supports gRPC by piaste on Wednesday February 02, 2022 @04:17PM (#30184184)
Which means you've opened an editor already to edit the request. Might as well send the request right there via an editor command/plugin.
Re:Postman Now Supports gRPC by halpert on Wednesday February 02, 2022 @06:31PM (#30185817)
Or you saved the response from a different curl request, or it’s checked into git, or a million different reasons.