The goal it is: instead of using a static string as the value for some header, you can use :@ operator to pass the desired value from a file.
Example, let's suppose I cd in a folder with a data.json file with content { "email": "...", "password": "..." } and a file "name.txt" with content as just Thales. You'll can...
treq POST httpbin.org/post \
name=@name.txt # Read a data field’s value from a file
datas:=@data.json # Embed a JSON object from a file
X-Data:@files/another-file.txt # Read a header from a file
token==@files/token.txt # Read a query parameter from a file
It must exist a function to receive input of "file path" and reader it, returning the String of content. This function would be called inside functions of parsers_request_items (that should pass to it the value they extracted from their input).
The objective is to replicate this feature in HTTPie (https://httpie.io/docs/cli/file-based-separators).
The goal it is: instead of using a static string as the value for some header, you can use :@ operator to pass the desired value from a file. Example, let's suppose I
cd
in a folder with a data.json file with content{ "email": "...", "password": "..." }
and a file "name.txt" with content as justThales
. You'll can...Additional Considerations:
This handler should live in input parsers to request data.
It must exist a function to receive input of "file path" and reader it, returning the String of content. This function would be called inside functions of parsers_request_items (that should pass to it the value they extracted from their input).