How to run a single request from a file
Problem to solve
How to run a single request from a file that has many? For example, I have 4 requests in one file, but I only want to run the 3rd one?
As far as I understood, the --to-entry flag runs all requests in a file up to an entry number.
Proposal
Could there be an accompanying command-line option for running a single request in a file?
Additional context and resources
Tasks to complete
- [ ] ...
Hi @kai687,
we could naturally add --from--entry option,
and maybe also --entry
When using --to-entry, I find myself wanting to have the option --to-line: it easier to view a request line in an editor than to count the corresponding entry number (see #1820). In the same vein, we could add --line to execute a particular request at at particular line number.
@jcamiel Since a request entry can span multiple lines, what if that line is a comment? Or part of an Asserts block?
Yes exactly we've to defined this!
I'll be happy with --to-line executing the request on the exact line or the last request before this line. We could even return an error if there is no request at the specified line. Both behavior will be better than counting the request in the file to know what is the entry of the request I want to execute (which I'm doing every time I use --to-entry)
@fabricereix I would like to see multi request single file support similar to the http vscode extension
This is an example of what the file format from the extension supports:
@hostname = api.example.com
@port = 8080
@host = {{hostname}}:{{port}}
@contentType = application/json
@createdAt = {{$datetime iso8601}}
@modifiedBy = {{$processEnv USERNAME}}
###
@name = hello
GET https://{{host}}/authors/{{name}} HTTP/1.1
You can define variables on a top level without coupling to a request and each request can have it's own custom @name identifier.
With this feature, Hurl can run a single request based on a @name value the user provides
Yes, relating to your @name attribute, we plan to add metadata for each request (#1949)
With Hurl 4.3.0, we've introduced --from-entry option. Combined with --to-entry the two options can be used to execute a particular entry.