-
Notifications
You must be signed in to change notification settings - Fork 473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
An easy way to reuse requests #317
Comments
That could be useful but we are also afraid that it will bring a lot of other issues: error reporting, imports cycles,... For the time-being, we recommend to generate the Hurl files (with scripts) when we need to reuse common requests. |
Do hurl files share the same session when passed as a parameter? If so, one could just do |
Each Hurl file has each own session.
|
the sign of a successful project? |
Today, I've refactored our scripts that generate the hurl files. Before, it was a bash script that outputs hurl contents (by using Instead, I've refactored it to use a "preprocessor" that replaces The file sill has valid hurl syntax, because # is also the start of a comment. So no syntax highlighting is broken:
This seems to work pretty good for us at the moment. |
Thanks @nikeee for sharing! |
If this is something you'd be interested in, I'd file a PR for the contrib folder (and make it a bit more resistent; for example, trailing whitespace does not work yet). While implementing and using that, I realized that some users might want to add parameters to scripts or override variables respectively. For example, you can call hurl and set a variable that is used in the hurl file: hurl --variable host="example.com" a.hurl THis might be useful when including/re-using hurl files. I modeled a workflow where there are two users, with two different sessions. Depending on the action included, it might make sense to override variables in the includes:
(the syntax is only for demonstration of the idea, not an actual proposal) This is not supported in the preprocessor script above as I managed to get around the need for that (yet). |
Yes, you can file a PR in |
Duplicate #2110 |
While this works, once you get an error, you have no clue where it comes from. |
(Imported from original discussion @spaceaardvark)
I don't think there's a way to do this yet, but it would be great to have an easy way to reuse a request in multiple
.hurl
files.For example, suppose
sign-in.hurl
signs in a test user in and extracts their name and email from the response. I would like to reuse that request intest-1.hurl
andtest-2.hurl
without having two duplicate everything insign-in.hurl
.The text was updated successfully, but these errors were encountered: