TylerReid / bloop

Postman alternative, with toml based config and fancy variables.
MIT License
1 stars 0 forks source link

Bloop

Bloops things! A postman alternative that uses TOML as a configuration file. It automatically detects used variables and performs actions needed to satisfy them, such as reading from a file, making another request and pulling out values, or running an arbitrary script.

Bloops runs on MacOs, Linux, and Windows.

Usage

Bloop can be used either as a cli or as a terminal gui.

Requests

Named http requests to make

[request.florp]
uri = "http://localhost:5284/echo"
method = "POST"
body = "{}"
content_type = "application/json"
headers = { Authorization = "Bearer ${mySuperSecretToken}" }

[request.somejson]
uri = "https://stackoverflow.com/api/recent-chat"

Properties

uri

Variables

Variables can be used in request header values, bodies, and the uri by using ${someVariableName} inside of the definition. Values come from various sources defined in the properties or passed to the cli with --var someKey=value,otherKey=derp

[variable.activeUsers]
source = "somejson"
jpath = "$.activeUsers"

[variable.command]
command = "./scripts/testVariableScript.ps1"

Properties

value

Variable Sets

Sometimes you want to have swappable sets of variables, for example when interacting with multiple deployment environments. To support this bloop variables support environment sets. Each variable in a variable set has all the properties of a normal top level variable. The -s or --set cli option can be used to select an env set.

[request.someApi]
uri = "https://${host}/floob"
headers = { Authorization = "Bearer ${token}" }

[variable.host]
default = "dev.example.com"

[variableset.host.staging]
env = "STAGE_HOST"

[variableset.host.prod]
file = ".prod_host"

[variable.token]
file = ".token"

[variableset.token.staging]
command = "./getToken.ps1"
command_args = "stage"
value_lifetime = "00:10:00"

[variableset.token.prod]
command = "./getToken.ps1"
command_args = "prod"
value_lifetime = "00:03:00"
bloop someApi --set prod

Default values

[defaults]
headers = { X-Bloop = "${yep}" }

Header values that will be added to every request if not already specified

Dev and Build

Bloop requires the latest .net for the main application, and powershell for scripts and tests

To build: dotnet build

To produce release mode outputs in the ./releases/ directory: ./scripts/buildCli.ps1

To run integration tests: ./tests/IntegrationTests/runTests.ps1