Feature request: #!/usr/bin/hurl
Hi,
Here a wish list issue:
Enhance text file processing, make hurl an interpreter like /bin/bash and /usr/bin/python3.
So a file with content like
#!/usr/bin/hurl
# login script
GET https://www.sample.net
x-app: MY_APP # Add a dummy header
HTTP/1.1 302 # Check that we have a redirection
[Asserts]
header "Location" exists
header "Location" contains "login" # Check that we are redirected to the login page
and given execute permissions can be used as script.
Hello, in fact, it is already working with Linux/bash.
Here is the run of your example.
$ ./test.hurl
error: Assert Http Version
--> test.hurl:5:6
|
5 | HTTP/1.1 302 # Check that we have a redirection
| ^^^ actual value is <2>
|
error: Assert Status
--> test.hurl:5:10
|
5 | HTTP/1.1 302 # Check that we have a redirection
| ^^^ actual value is <200>
|
error: Assert Failure
--> test.hurl:7:0
|
7 | header "Location" exists
| actual: none
| expected: something
|
error: Assert Failure
--> /tmp/test2.hurl:8:0
|
8 | header "Location" contains "login" # Check that we are redirected to the login page
| actual: none
| expected: contains string <login>
|
It would be indeed interesting to see if we can make it work in various environments. I also really like this unobtrusive enhancement.
What is your OS/Shell? What is the Hurl behavior?
On Thu, Mar 23, 2023 at 02:54:25PM -0700, Jean-Christophe Amiel wrote:
Closed #409 as completed.
Ah, nice. And thanks for the notification.
(For the record: No testing yet done by me.)