http-request-cli

0.2.0 • Public • Published

H

Simple CLI to query HTTP endpoints.

Install

npm i -g http-request-cli

Now you have h as a command to query http endpoint in your terminal.

Usage

Usage: h [options] [command]
 
Options:
  -V, --version               output the version number
  -v, --verbose               Verbose mode
  --no-color                  Monochrome display
  -o, --output <file name>    Save response to a file
  -y, --yaml                  Render JSON data in a coloured YAML-style
  -H, --header <name=value>   Set a header (default: {})
  -d, --data [data]           Content of request
  -D, --datafile <file name>  
  -t, --type <content type>   Content type
  -c, --cookie <cookie file>  Cookie file
  -h, --help                  output usage information
 
Commands:
  get <url> [options]         Send a GET request
  post <url> [options]        Send a POST request
  put <url> [options]         Send a PUT request
  delete <url> [options]      Send a DELETE request
  patch <url> [options]       Send a PATCH request
  head <url> [options]        Send a HEAD request

Examples

  • Simple GET request
h get https://jsonplaceholder.typicode.com/todos/1

simple query

  • GET request with response formatted as YAML
h get https://jsonplaceholder.typicode.com/todos/1 -y

simple query yaml

  • POST request with data provided as JSON
h post https://jsonplaceholder.typicode.com/posts -d '{"name":"bob"}'

post json

  • POST request with data provided as properties and converted into JSON
h post https://jsonplaceholder.typicode.com/posts -d name=alice

post props

TODO

  • Automatic save of binary files (images, pdf, ...)
  • Headers provided in a file
  • Proxy support [first version: to be largely tested]
  • Type of authentication (basic, ...) + Username/password
  • POST by default when data is provided
  • Progress bar

Readme

Keywords

none

Package Sidebar

Install

npm i http-request-cli

Weekly Downloads

36

Version

0.2.0

License

MIT

Unpacked Size

412 kB

Total Files

9

Last publish

Collaborators

  • bbonnin