Headers File
The headers file can be used to send fixed-value headers. The most common use case is authentication headers.
Headers can be path-specific or applicable to all paths using the all element. Specific paths will take precedence over the all element.
Sample headers file:
all:
Accept: application/json
"/path/0.1/*":
X-Tenant: acme
"POST /path/0.1/auth":
jwt: XXXXXXXXXXXXX
/path/0.2/cancel:
jwt: YYYYYYYYYYYYY
This will add the Accept header to all calls, X-Tenant to all paths starting with /path/0.1/, and the jwt header to the specified method/paths. Exact "METHOD /path" entries take precedence over exact "/path", which take precedence over "METHOD /prefix*", "/prefix*", and all.
Alternatively, you can supply headers using the -H name=value argument. Those headers will apply to all paths.
You can use environment (system) variables in a headers file or inline -H flag using $$VARIABLE_NAME.
$$VAR)$$VARIABLE_NAME resolves only when it is the entire header value (for example Authorization: "$$API_AUTH" after export API_AUTH='Bearer eyJ...', rather than "Bearer $$API_TOKEN"). When passing -H 'Authorization=$$API_AUTH' on the command line, always use single quotes so the shell does not expand $$ to its own process ID. Also note that all and path-only keys protect headers from runtime header correlation, whereas method-scoped keys ("POST /path") only replace the header value for that method.