Crates.io | curlz |
lib.rs | curlz |
version | 0.1.0-alpha.12 |
source | src |
created_at | 2022-08-08 10:37:36.257248 |
updated_at | 2023-03-24 13:40:19.206046 |
description | curl wrapper with placeholder, bookmark and environment powers just like postman |
homepage | |
repository | |
max_upload_size | |
id | 640767 |
size | 181,021 |
a curl wrapper with placeholder, bookmark and environment powers just like postman but for the terminal
.env
and .yaml
environment files--
, that makes a drop-in-replacement for curl{{ prompt_password() }}
curlz r https://api.github.com/user -- -u "{{ username }}:{{ prompt_password() }}"
{{ prompt_for("Username") }}
or {{ prompt_for("Birthdate") }}
curlz -- -u "{{ prompt_for("Username") }}:{{ prompt_password() }}" https://api.github.com/user
curlz r --define 'host=https://httpbin.org' '{{host}}/get'
{{ jwt(claims, jwt_signing_key) }}
, where claims
and jwt_signing_key
are looked up at the environment file or can be directly provided map and string
curlz r -H 'Authorization: Bearer {{ jwt({"uid": "1234"}, "000") }}' https://httpbin.org/bearer -- -vvv
-d | --data
curlz r -d 'Hello World' -X POST https://httpbin.org/anything
--json
argument
curlz r --json '{ "foo": "bar" }' -X POST 'https://httpbin.org/anything'
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
curlz r https://api.github.com/gitignore/templates/Rust
curlz r 'https://api.github.com/gitignore/templates/{{ prompt_for("Language") | title }}'
curlz r --bookmark 'https://api.github.com/gitignore/templates/{{ prompt_for("Language") | title }}'
Language: rust
Please enter a bookmark name: gitignore
curlz r gitignore
jwt(claims: map, [jwt_signing_key: string])
claims
: to be a map of key value pairs like {"uid": "1234"}
that are the payload of the JWTjwt_signing_key
: to be a string, this is optional and can be provided at the environment file with a variable named jwt_signing_key
HS256
and the JWT header is {"alg": "HS256", "typ": "JWT"}
exp
expiry time is set to in 15min by default, but can be overwritteniat
issued at timestamp is set automatically and cannot be overwritten