Support two types of default values in request files:
- static
{{FOO:bar}} - if no value is present for variable FOO use static value bar
- dynamic
{{FOO|bar}} - if no value is present for variable FOO invoke shell command bar which should provide a value instead
Static default value
For example
url: https://example.com
method: POST
headers:
content-type: {{CONTENT_TYPE:application/json}}
So if a value is provided for CONTENT_TYPE it will always be used, regardless of where (i.e interactively, on the command line, through an environment or secret file) and only if no value is provided will we use the default value (application/json).
If a default value is provided and the --interactive flag is present, the user will NOT be asked to provide a value. Asking the user will only be done as a last resort.
Dynamic default value
For example
url: https://example.com
method: POST
headers:
x-correlation-id: {{CORRELATION_ID|uuidgen}}
Similar to a static default value; if a value id provided somehow for CORRELATION_ID it will be used, but otherwise we will get a value by invoking the shell command uuidgen. So
Support two types of default values in request files:
{{FOO:bar}}- if no value is present for variableFOOuse static valuebar{{FOO|bar}}- if no value is present for variableFOOinvoke shell commandbarwhich should provide a value insteadStatic default value
For example
So if a value is provided for
CONTENT_TYPEit will always be used, regardless of where (i.e interactively, on the command line, through an environment or secret file) and only if no value is provided will we use the default value (application/json).If a default value is provided and the
--interactiveflag is present, the user will NOT be asked to provide a value. Asking the user will only be done as a last resort.Dynamic default value
For example
Similar to a static default value; if a value id provided somehow for
CORRELATION_IDit will be used, but otherwise we will get a value by invoking the shell commanduuidgen. So