curlz icon indicating copy to clipboard operation
curlz copied to clipboard

http language: variable assignment

Open sassman opened this issue 2 years ago • 0 comments

Extension to the http language file format #5

A request can declare variables that are available as regular variables. A new variable is declared by the prefix @ in front of the variable name.

Example

###

@id = 2
@hostname = httpbin.org
@port = 443
@host = {{hostname}}:{{port}}

GET https://{{host}}/get?id={{id}} HTTP/1.1

Example CLI

the equivalent via the CLI is this:

curlz r --define id=2 \
  --define hostname=httpbin.org \
  --define port=443 \
  --define 'host={{hostname}}:{{port}}' \
  'https://{{host}}/get?id={{id}}'

sassman avatar Jan 07 '23 17:01 sassman