Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kevinpollet/http2-cli
Modern and lightweight command line HTTP/2 client
https://github.com/kevinpollet/http2-cli
client command-line http http2 nodejs typescript
Last synced: 2 months ago
JSON representation
Modern and lightweight command line HTTP/2 client
- Host: GitHub
- URL: https://github.com/kevinpollet/http2-cli
- Owner: kevinpollet
- License: mit
- Created: 2019-05-06T04:20:46.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T21:45:30.000Z (about 2 years ago)
- Last Synced: 2024-04-26T10:42:14.934Z (9 months ago)
- Topics: client, command-line, http, http2, nodejs, typescript
- Language: TypeScript
- Homepage:
- Size: 1.38 MB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 24
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# http2-cli · [![Build Status](https://dev.azure.com/kevinpollet/http2-cli/_apis/build/status/kevinpollet.http2-cli?branchName=master)](https://dev.azure.com/kevinpollet/http2-cli/_build/latest?definitionId=2&branchName=master) [![License](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE.md)
> Modern and lightweight command line HTTP/2 client.
## Install
**npm**
```shell
npx http2-cli # Use it once.
npm install -g http2-cli # Install globally.
```**yarn**
```shell
yarn global add http2-cli # Install globally.
```## Usage
```shell
http2 [headers..]Positionals:
method HTTP method [required] [choices: "DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH"]
url HTTP URL to request [required]
headers HTTP headers to send with the request, e.g. Content-Type:application/jsonOptions:
--help Show help [boolean]
--version Show version number [boolean]
--auth Specify the authentication credentials [string]
--auth-type Specify the authentication mechanism [choices: "Basic", "Bearer"] [default: "Basic"]
--insecure Disable the host SSL/TLS certificate verification [boolean]
--verbose Display the HTTP response headers [boolean]
```## Examples
Here are some command examples with the corresponding output:
### GET request with basic authentication
```shell
http2 get https://nghttp2.org:443/httpbin/basic-auth/test/test --auth test:test{
"authenticated": true,
"user": "test"
}
```### POST request with redirected input
```shell
http2 post https://nghttp2.org:443/httpbin/post Content-Type:application/json < foo.json{
"args": {},
"data": "{\n \"bar\": \"baz\"\n}\n",
"files": {},
"form": {},
"headers": {
"Content-Type": "application/json",
"Host": "nghttp2.org:443",
"Transfer-Encoding": "chunked"
},
"json": {
"bar": "baz"
},
"origin": "129.122.96.213",
"url": "https://nghttp2.org:443/httpbin/post"
}
```## ️️Docker
For docker ❤️ you can run `http2-cli` with docker. You can use a prebuilt docker image or build your own. For example the following command run the latest prebuilt docker image of `http2-cli`:
```shell
docker run --rm kevinpollet/http2-cli:latest --versionhttp2-cli/1.1.0 linux-x64 node-v12.3.1
```With docker, it's also possible to use Unix redirections and pipes! Try the following commands:
```shell
docker run --rm -i kevinpollet/http2-cli:latest post https://nghttp2.org/httpbin/post < foo.json{
"args": {},
"data": "{\n \"bar\": \"baz\"\n}\n",
"files": {},
"form": {},
"headers": {
"Host": "nghttp2.org:443",
"Transfer-Encoding": "chunked"
},
"json": {
"bar": "baz"
},
"origin": "129.122.96.213",
"url": "https://nghttp2.org:443/httpbin/post"
}echo -e '{ "hello": "world" }' | docker run --rm -i kevinpollet/http2-cli:latest post https://nghttp2.org/httpbin/post | jq ".json"
{
"hello": "world"
}
```## Contributing
Contributions are welcome!
Want to file a bug, request a feature or contribute some code?
Check out the [contribution guidelines](./CONTRIBUTING.md).
## License
[MIT](./LICENSE.md)