Let's discover httpx in less than 5 minutes.
Please install httpx from https://github.com/httpx-sh/httpx/releases
If you are Mac user, please use
brew install httpx-sh/tap/httpx to install httpx.
Create index.http file
Create a simple index.http file with following code:
#!/usr/bin/env httpx --httpfile
### get my internet ip
# @name myip
Then you can input
httpx myip to invoke http request. Or you can input
chmod u+x index.http then execute
How httpx to find http file?
- http file assigned by
- httpx will look
index.httpby default if no http file assigned
- If httpx can not find
index.httpin current directory, and it will look
index.httpin parent directory until root directory.
- If index.http not found in parent directory chain, and it will try to find
~/.servicex/index.httpas default index.http
Environment variables overwrite?
httpx supports to load environment variables from
http-client.private.env.json, and compatible with JetBrains HTTP Client plugin.
For some cases, you want to overwrite environment variables from command line, and you can use
For example, you have a http request:
### fetch user detail
you can use
httpx user --id=111 to overwrite id value from
- Space style:
--id xxxnot allowed, and you should use
- Reserved variables:
list, data, summary, and they are option names for httpx CLI