Show HN: A Swiss army knife for testing HTTP from the terminal
Just released Artillery Probe - a Swiss army knife for testing HTTP from the CLI. Think mini-curl with better UX for common use-cases, plus a couple of extra features.
Would love for you to try it and give some feedback!
https://www.artillery.io/blog/swiss-army-knife-for-http-testing
and:
npm install artillery@latest
What does it do?- First of all, it's a HTTP client! It does all the usual stuff you'd expect from a HTTP client... HTTP methods, request bodies, custom headers, forms, Basic Auth etc.
- Got some JSON or XML back? It'll pretty-print it, and syntax highlight it for you.
- It'll show you request waterfalls like this one: (inspired by httpstat)
DNS Lookup | TCP Connection | SSL Handshake | Time to First Byte | Content Transfer
56ms | 14ms | 19ms | 181ms | 88ms |
| | | | |
56ms | | | |
70ms | | |
89ms | |
270ms |
total:358ms
- JSON responses can be queried and sliced and diced with JMESPath (same syntax as AWS CLI) - no need to reach for jq. XML & HTML may be queried with a jQuery-like syntax too.- You can set expectations on the response, e.g. have the CLI check that the response is a 200, or that a certain header is set, and exit with non-zero code if not. Super handy for quick acceptance testing.
We've got lots of ideas for improvements, but would love to hear what you think!
46 comments
[ 1.8 ms ] story [ 108 ms ] threadSorry, lost me at this part. Have a better installation story like a single executable.
Beyond that, what does this do that curl, wget, et al do not? How is your interface better than those? Is it robust in the face of errors? What http protocol versions does it support?
As to what it does better than curl/wget. Probe is geared towards interactive use with HTTP APIs. So you get syntax highlighting and pretty printing for JSON, built-in querying, request waterfall visualizations, and ability to set expectations on every response.
HTTP/2 is supported.
Does artillery properly escape the environment variables into json strings? I don't see how it could if you're using bash expansion in double quotes. This feature would only work with string values without spaces or special characters. Don't really see any improvement here.
https://www.artillery.io/blog/swiss-army-knife-for-http-test...
So by embedding a json query evaluator in your http client, this means that every time I iterate on my JMESPath query I'm making a new request? Is there an offline mode? What if my Json file is 200MiB? Or if the request was not idempotent?
Just saying there's good reasons why json query features are not typically built into one-shot http request tools. However, if your tool was not one-shotand you had an interactive session and cached/stored the entire result and then allow the user to interactively query it, then I could see some better value here.
Good point on iterating on the query! We already save the body into a temp file, so we can make Probe be able to run queries on a file. Adding it to the todo list. :)
(In my own workflow I use gron a lot for getting an overview of the shape of unfamiliar JSON, super handy tool)
As to an interactive shell… yes, 100%. Kicking ideas around something like that as well!
I believe that has more sharp edges than one might suspect
The user may be less surprised if the flag were named "--yaml-as-json" or whatever DX friendly variant one wishes, in order to more clearly mark that string as yaml. The user is actually told about the "JSON or YAML", but only if they try to include some scalar value that isn't legal yamlAlso, I appreciate that every service should strive to respond in 10s, but there wasn't an obvious way to get it to be more patient
followed by a ginormous stacktrace and a console.error dump of some event objectyou’re right on that YAML-as-JSON thing. If everything is quoted as JSON, those type conversions shouldn’t kick in. Otherwise there’s room for surprises - perhaps we can do something to make those cases more obvious.
Holy guacamole this is an entitled sentiment. It’s an open source project and it’s free.
apt install, pip install, git clone && ./configure && make && make install?
they don’t get VC-funded by YCombinator, do they?
/s
We want to extend those with support for Server-Timing next, and also Core Web Vitals [3] (via Playwright) for web pages.
1. https://github.com/reorx/httpstat
2. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Se...
3. https://web.dev/vitals/
1: https://httpie.io/
[1] https://hurl.dev
I don't think I could move to anything else for that reason alone.
I imagine other editors have similar plugins.
Syntax highlighting
Request performance waterfalls
Built-in JMESPath queries for JSON (same syntax as in AWS CLI). XML and HTML can be queried too.
Ability to set checks on the response. This one is super handy for quick acceptance tests.
edit: it looks like you need to install 1276 npm dependencies to use this tool
https://github.com/artilleryio/artillery/network/dependencie...
i'll pass, the risk is unacceptable for value it offers, especially in corporate environments
npm is not for end users.
packaging Node in a binary won't solve the problem of JavaScript's plagued ecosystem and in fact i'd rather prefer to be able to mitigate the issues/update packages myself rather than waiting for a new binary to release
However, packaging node in a binary is pretty much what electron does today, albeit with a GUI.
Regardless, it's not a problem I wish to spend any effort to solve since it's not my problem and I've (we've) already dismissed the premise (writing CLI tools in js) lol.
what technically prevents you from designing the tool independent of the Node.JS and JavaScript ecosystem?
> Snyk.io for dependency scanning
so what? does the CLI update itself automatically?
The world is a big place. There’s a lot of software out there written in Node.js, used happily and productively by millions of developers, many of them in corporate environments.
Given the opinions you expressed elsewhere in the thread here I think it’s clear that this tool is not for you. I hope no one is forcing you to use it.
> it looks like you need to install 1276 npm dependencies to use this tool
Sincere question (probably highlights my lack of understanding Node package management): how can this be a "mini" curl with that many dependencies?
the number of packages is a bit of a misnomer anyway. Artillery Probe is part of Artillery which does load testing, with multiple protocols, support for multi-step scenarios, publishing to a variety of monitoring systems (Datadog, Prometheus etc) and more. That’s what most of those packages enable.
I mentioned elsewhere in the comments that we have a Docker image, and are working on other methods of installing the CLI to alleviate some of these dependency-related concerns.
Getting side tracked here, but there seems to be a common sentiment when it comes to Node.js that it's uniquely insecure. Node.js has indeed had some unfortunate press when it comes to supply-chain security, but every other runtime is susceptible to those attacks (PiPy, Gems, Maven, Rust Crates). Ultimately of course, if you choose to avoid using any software built on top of those stacks, that's your choice.
Artillery specifically is no different to any other Node.js-based project in how large the dependency tree is. VSCode for instance is used by millions of developers has 1.6k dependencies [1].
1. https://github.com/microsoft/vscode/network/dependencies
Yes, of course. I was just taking an arbitrary example from my common HTTP toolbox.
> VSCode for instance is used by millions of developers has 1.6k dependencies [1].
VSCode is maintained by Microsoft plus a huge community and they are transparent about their process in regards of auditing/freezing dependencies.