tldr/pages/common/xh.md

29 lines
693 B
Markdown
Raw Normal View History

2021-04-05 14:01:13 +01:00
# xh
> Friendly and fast tool for sending HTTP requests.
2021-04-05 14:01:13 +01:00
> More information: <https://github.com/ducaale/xh>.
2021-04-05 14:11:13 +01:00
- Send a GET request:
2021-04-05 14:01:13 +01:00
2021-04-05 14:08:16 +01:00
`xh {{httpbin.org/get}}`
2021-04-05 14:01:13 +01:00
2021-04-05 14:11:13 +01:00
- Send a POST request with JSON body: `{"name": "ahmed", "age": 25}`:
2021-04-05 14:01:13 +01:00
2021-04-05 14:08:16 +01:00
`xh post {{httpbin.org/post}} {{name=john}} {{age:=25}}`
2021-04-05 14:01:13 +01:00
2021-04-05 14:11:13 +01:00
- Send a GET request with querystring id=5&sort=true:
2021-04-05 14:01:13 +01:00
2021-04-05 14:08:16 +01:00
`xh get {{httpbin.org/get}} {{id==5}} {{sort==true}}`
2021-04-05 14:01:13 +01:00
- Send a GET request with a custom header:
2021-04-05 14:01:13 +01:00
`xh get {{httpbin.org/get}} {{header-name:header-value}}`
2021-04-05 14:01:13 +01:00
2021-04-05 14:11:13 +01:00
- Send a PUT request and pipe the result to less:
2021-04-05 14:01:13 +01:00
2021-04-05 14:08:16 +01:00
`xh put {{httpbin.org/put}} {{id:=49}} {{age:=25}} | less`
2021-04-05 14:01:13 +01:00
2021-04-05 14:11:13 +01:00
- Download and save to res.json:
2021-04-05 14:01:13 +01:00
2021-04-05 14:08:16 +01:00
`xh -d {{httpbin.org/json}} -o {{res.json}}`