a curl wrapper with placeholder, bookmark and environment powers just like postman but for the terminal
Features
- ☑️.env files
- ☑️.yaml env files
- ☑️placeholder evaluation, with the minijinja template engine
- in urls
- in http headers (
-H | --headerarguments) - in every other passed curl parameter
- ☑️save request as a bookmark, containing
- curl arguments
- http headers
- http method
- placeholders
- ☑️pass all arguments after
--to curl, that makes drop-in-replacement possible - ☑️execute a bookmarked request
- ☑️special placeholder variables that would interact with the user
- ☑️prompt for a password as
{{ prompt_password() }}curlz r https://api.github.com/user -- -u "{{ username }}:{{ prompt_password() }}" - ☑️prompt for interactive input with a label as
{{ prompt_for("Username") }}or{{ prompt_for("Birthdate") }}curlz -- -u "{{ prompt_for("Username") }}:{{ prompt_password() }}" https://api.github.com/user
- ☑️prompt for a password as
- ☑️evaluate placeholders at the beginning of an url like:
- ☑️special placeholder for developers, like for Json Web Tokens (JWT)
- example:
{{ jwt(claims, signing_key) }}, whereclaimsandsigning_keyare looked up at the environment file or can be directly provided map and string
- example:
TODOs
- support rest client template language see #5
Example #1
In this example we're going to download a pre-configured .gitignore for a given language from GitHub via curl
curl https://api.github.com/gitignore/templates/Rust- the same with curlz:
curlz r https://api.github.com/gitignore/templates/Rust - Add a placeholder that is interactively requested
curlz r 'https://api.github.com/gitignore/templates/{{ prompt_for("Language") | title }}' - Now let's bookmark this request:
- Finally, we can keep using the bookmark from now on:
curlz r gitignore
Template functions
Json Web Token - jwt(claims: map, [signing_key: string])
- arguments:
claims: to be a map of key value pairs like{"uid": "1234"}that are the payload of the JWTsigning_key: to be a string, this is optional and can be provided at the environment file with a variable namedjwt_signing_key
- output: string is a Json Web Token (JWT)
- notes:
- the hash algorithm is
HS256and the JWT header is{"alg": "HS256", "typ": "JWT"} - the claim
expexpiry time is set to in 15min by default, but can be overwritten - the claim
iatissued at timestamp is set automatically and cannot be overwritten
- the hash algorithm is