Skip to content

Latest commit

 

History

History
62 lines (37 loc) · 1001 Bytes

README.md

File metadata and controls

62 lines (37 loc) · 1001 Bytes

hrun

HTTP request runner with a simple DSL based on JavaScript.

Install

Download the latest release

or install using GoBinaries:

$ curl -sf https://gobinaries.com/speier/hrun | sh

Usage example

Create a script:

const host = 'https://httpbin.org'

GET(`${host}/get`)
POST(`${host}/post`, 'Accept: application/vnd.foobar.v2+json', { payload: { data: 'foobar' }})

Run the script:

$ hrun examples/basic.js

API

All HTTP method is a function with an URL, headers and payload arguments:

METHOD(URL, [headers], [payload])

URL: required

[headers]: optional

[payload]: optional

CLI

The following flags are available:

-e: set env var, key=value or filename (repeatable)

For example:

$ hrun -e=1 -e=2 -e bar.env foo.js

Flag -e is repeatable and can be key=value or a filename to load env vars, will be available on env object from the scripts.

License

MIT