lac supports Yaml and JSON files, but this manual only uses JSON.
Create request:
// createPet.json
{
"method": "POST",
"path": "https://api.example.com/v1/pet",
"headers": {
"Content-Type": "application/json"
},
"body": {
"name": "Princess",
"type": "dog",
"breed": "bulldog"
}
}Send request:
lac createPet.jsonlac can use paased variables and preload .env
// variables.json
{
"petId": "id-1"
}# .env
API_KEY=mysecretkeyTo use variables in request, write it surrounded by ${ and }.
// getPet.json
{
"method": "GET",
"path": "https://api.example.com/v1/pet/${petId}",
"headers": {
"x-api-key": "${API_KEY}"
}
}Then pass variables to lac
lac getPet.json --vars variables.jsonlac can use passed headers and headers can contain variables.
// headers.json
{
"Content-Type": "application/json",
"x-api-key": "${API_KEY}"
}Pass headers and variables to lac
lac getPet.json --vars variables.json --headers headers.json