diff --git a/sites/highlight.py b/sites/highlight.py index bb96b1c..5a1b779 100755 --- a/sites/highlight.py +++ b/sites/highlight.py @@ -148,6 +148,7 @@ def shell_to_html(snippet: str) -> str: output = output.replace("\x1B[32m", '') output = output.replace("\x1B[34m", '') output = output.replace("\x1B[35m", '') + output = output.replace("\x1B[90m", '') output = output.replace("\x1B[1;36m", '') output = output.replace("\x1B[1;31m", '') output = output.replace("\x1B[1;32m", '') diff --git a/sites/hurl.dev/_posts/2024-04-24-announcing-hurl-4.3.0.md b/sites/hurl.dev/_posts/2024-04-24-announcing-hurl-4.3.0.md new file mode 100644 index 0000000..b1f4da8 --- /dev/null +++ b/sites/hurl.dev/_posts/2024-04-24-announcing-hurl-4.3.0.md @@ -0,0 +1,303 @@ +--- +title: Announcing Hurl 4.3.0 +layout: blog +section: Blog +permalink: /blog/:year/:month/:day/:title.html +--- + +# {{ page.title }} + + + +The Hurl team is thrilled to announce [Hurl 4.3.0] Surfer ! + +[Hurl] is a command line tool powered by [curl], that runs HTTP requests defined in a simple plain text format: + +```hurl +GET https://example.org/api/tests/4567 +HTTP 200 +[Asserts] +header "x-foo" contains "bar" +certificate "Expire-Date" daysAfterNow > 15 +jsonpath "$.status" == "RUNNING" # Check the status code +jsonpath "$.tests" count == 25 # Check the number of items +jsonpath "$.id" matches /\d{4}/ # Check the format of the id +``` + +## What’s New in This Release + +- [Quality of Life Improvements](#quality-of-life-improvements) +- [Shell Completion](#shell-completion) +- [One More Thing...](#one-more-thing) +- [Others](#others) + +## Quality of Life Improvements + +Hurl 4.3.0 is about bringing various __quality of life improvements__. Nothing fancy, but Hurl keeps iterating, +improving and increasing usefulness on each new release. + + +### Error display + +{% comment %} +Speak of --error-format long +{% endcomment %} + +Errors display have been slightly improved, with the request line displayed to give context without having to look in +the Hurl source file. + +Before 4.3.0: + +{% raw %} +```shell +error: Undefined variable +--> tests_ok/post_file.hurl:6:8 + | + 6 | file,{{filename}}; + | ^^^^^^^^ you must set the variable filename + | +``` +{% endraw %} + +With 4.3.0: + +{% raw %} +```shell +error: Undefined variable +--> tests_ok/post_file.hurl:6:8 + | + | POST http://localhost:8000/post-file + | ... + 6 | file,{{filename}}; + | ^^^^^^^^ you must set the variable filename + | +``` +{% endraw %} + +### --netrc, --netrc-file, --netrc-optional + +Like its HTTP engine [curl], Hurl supports now the classic `.netrc` file (typically stored in a user's home directory). +With [`--netrc`] option, you can tells Hurl to look for and use the `.netrc` file. [`--netrc-file`] is similar +to `--netrc`, except that you can provide the path to the actual file to use. + +```shell +$ hurl --test --netrc-file /home/foo/.netrc *.hurl +``` + +### Per request --user + +Let's keep talking about curl options. Like curl, one can use the command line options [`--user`] to add basic authentication +to all the request of an Hurl file: + +```shell +$ hurl --user bob:secret login.hurl +``` + +`--user` option can now be set _per request_, in an [`[Options]` section]({% link _docs/request.md %}#options) section: + +```hurl +# Login with Bob is OK +POST http://foo.com/login +[Options] +user: bob:secret +location: true +HTTP 200 + +# Login with Alice is KO +POST http://foo.com/login +[Options] +user: alice:secret +location: true +HTTP 401 +``` + +This particular option is useful when using [AWS Signature Version 4]: Amazon S3 authenticated sessions can be set now per +request: + +```hurl +GET https://foo.execute-api.us-east-1.amazonas.com/dev/bafe12 +[Options] +aws-sigv4: aws:amz:eu-central-1:foo +user: someAccessKeyId:someSecretKey +HTTP 200 +``` + +And, last but not least, `--user` option can use [variables]: + +{% raw %} +```hurl +GET https://foo.execute-api.us-east-1.amazonas.com/dev/bafe12 +[Options] +aws-sigv4: aws:amz:eu-central-1:foo +user: {{login}}:{{password}} +HTTP 200 +``` +{% endraw %} + +Like many other Hurl option, `--user` option can be used in the command line (take effects for all requests of an Hurl +file), or per request, with an `[Options]` section: + +```hurl +GET https://example.org +# An options section, each option is optional and applied only to this request... +[Options] +aws-sigv4: aws:amz:sts # generate AWS SigV4 Authorization header +cacert: /etc/cert.pem # custom certificate file +compressed: true # request a compressed response +delay: 3000 # delay in ms for this request +http3: true # use HTTP/3 protocol version +insecure: true # allow insecure SSL connections and transfers +ipv6: true # use IPv6 addresses +location: true # follow redirection for this request +max-redirs: 10 # maximum number of redirections +output: out.html # dump the response to this file +path-as-is: true # do not handle sequences of /../ or /./ in URL path +skip: false # skip this request +unix-socket: sock # use Unix socket for transfer +user: bob:secret # use basic authentication +variable: country=Italy # define variable country +variable: planet=Earth # define variable planet +verbose: true # allow verbose output +very-verbose: true # allow more verbose output +``` + +The [options documentation] and the Hurl man page have been improved to show which option can be only use in command line +and which option can be used in command line _and_ in an `[Options]` section. When option can only be used in command line +the option is tagged "cli-only option". For instance: + +``` +--color + Colorize debug output (the HTTP response output is not colorized). + This is a cli-only option. +``` + +When "cli-only option" is not specified, the option can be set per request within an [`Options`] section. + +### --max-size + +One last new option back ported from curl, [`--max-size`] allows to limit the size of HTTP response data: + +```shell +$ hurl --max-size 100000 https://example.com/ +``` + +### New Predicates: isNumber, isIsoDate + +[Predicates] are used to add check on response: + +```hurl +GET http://httpbin.org/json +HTTP 200 +[Asserts] +jsonpath "$.slideshow.author" == "Yours Truly" +jsonpath "$.slideshow.slides[0].title" contains "Wonder" +jsonpath "$.slideshow.slides" count == 2 +jsonpath "$.slideshow.date" != null +jsonpath "$.slideshow.slides[*].title" includes "Mind Blowing!" +``` + +Two new predicates are introduced with 4.3.0: + +- `isNumber`: a companion to `isInteger` / `isFloat` existing predicates to test if a certain value is a number +- `isIsoDate`: check if a string value conforms to the [RFC-3339] date format `YYYY-MM-DDTHH:mm:sssZ` + +```hurl +GET http://httpbin.org/json +HTTP 200 +[Asserts] +jsonpath "$.slideshow.version" isNumber +jsonpath "$.slideshow.date" isIsoDate +jsonpath "$.slideshow.date" == "1937-01-01T12:00:27.87+00:20" +``` + +## Shell Completion + +Hurl now offers shell completion scripts for various shell: [bash], [fish], [zsh] and [PowerShell]. Usually, packet +managers package the completion scripts, but you can still install it yourself from [Hurl's GitHub repository]. + + +## One More Thing... + +One last thing, and this is a pretty big thing (at least for us Surfer) ! + +In Hurl 4.3.0, we've addressed [one of our oldest issue], proposed in Nomvember 2020: a `--parallel` option! +
+ + + + + Movies Box home page + + + + + + Movies Box home page + +
+ +It has been a long run since this issue, but we always kept in our mind that, at a moment, we want to be able to +run Hurl files in parallel. Now, with 4.3.0, we're introducing an opt-in option [`--parallel`] that will enable parallel +execution of Hurl files. + +In Hurl 4.3.0, running files in test mode is (no change): + +```shell +$ hurl --test *.hurl +``` + +With `--parallel`, you can choose to run your tests in parallel: + +```shell +$ hurl --test --parallel *.hurl +``` + +To develop this feature, we take a lot of inspiration of the venerable [GNU Parallel]. + +In the parallel mode, each Hurl file is executed on its own thread, sharing nothing with other files. There is a thread +pool with size is roughly the current amount of CPUs and that can be configured with `--jobs` option. During parallel +execution, standard output and error are buffered for each file and only displayed on screen when a job file is finished. +This way, debug logs and messages are never interleaved between execution. Order of execution is not guaranteed +in `--parallel` mode but reports (HTML, TAP, Junit) keeps the input files order. + +The parallelism used is multithread sync: the thread pool is instantiated for the whole run, each Hurl file is run +in its own thread, synchronously . We've not gone through the full multithreaded async route for implementation +simplicity. Moreover, there is no additional dependency, only the standard Rust lib with "classic" threads and multiple +producers / single consumer channels to communicate between threads. Surprinsingly, + +For the 4.3.0, we've marked the `--parallel` option as "experimental" as we want to have feedbacks on it and insure that +everything works as designed. We plan to make this mode of execution the default when executing Hurl files with `--test` +in the Hurl 5.0.0 version. + +Give it a try, if you think Hurl is fast, Oh Boy... Wait until you see the new parallel mode! + +## Others + +There are a lot other improvements with Hurl 4.3.0 and also a lot of bug fixes, +you can check the complete list of enhancements and bug fixes [in our release note]. + +If you like Hurl, don't hesitate to [give us a star on GitHub] or share it on [Twitter]! + +We'll be happy to hear from you, either for enhancement requests or for sharing your success story using Hurl! + + +[Hurl]: https://hurl.dev +[curl]: https://curl.se +[Hurl 4.3.0]: https://github.com/Orange-OpenSource/hurl/releases/tag/4.3.0 +[`--netrc`]: {% link _docs/manual.md %}#netrc +[`--netrc-file`]: {% link _docs/manual.md %}#netrc-file +[`--user`]: {% link _docs/manual.md %}#user +[AWS Signature Version 4]: https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html +[variables]: {% link _docs/templates.md %}#injecting-variables +[options documentation]: {% link _docs/manual.md %}#options +[`Options`]: {% link _docs/request.md %}#options +[`--max-size`]: {% link _docs/manual.md %}#max-size +[Predicates]: {% link _docs/asserting-response.md %} +[RFC-3339]: https://www.rfc-editor.org/rfc/rfc3339 +[fish]: https://fishshell.com +[zsh]: https://ohmyz.sh +[PowerShell]: https://learn.microsoft.com/en-us/powershell/ +[bash]: https://ftp.gnu.org/gnu/bash/ +[Hurl's GitHub repository]: https://github.com/Orange-OpenSource/hurl/tree/master/completions +[one of our oldest issue]: https://github.com/Orange-OpenSource/hurl/issues/87 +[GNU Parallel]: https://www.gnu.org/software/parallel/ \ No newline at end of file diff --git a/sites/hurl.dev/_sass/_code.scss b/sites/hurl.dev/_sass/_code.scss index 8851aac..80a71fb 100644 --- a/sites/hurl.dev/_sass/_code.scss +++ b/sites/hurl.dev/_sass/_code.scss @@ -184,6 +184,10 @@ pre, code { color: $ansi-green-light; color: var(--ansi-green); } + .gray { + color: $ansi-gray-light; + color: var(--ansi-gray); + } .bright-cyan { color: $ansi-bright-cyan-light; color: var(--ansi-bright-cyan); @@ -209,7 +213,6 @@ pre, code { color: var(--ansi-bright-magenta); font-weight: bold; } - } .language-rust { diff --git a/sites/hurl.dev/_sass/_colors.scss b/sites/hurl.dev/_sass/_colors.scss index f5286a4..5c08382 100644 --- a/sites/hurl.dev/_sass/_colors.scss +++ b/sites/hurl.dev/_sass/_colors.scss @@ -45,6 +45,7 @@ $bash-literal-string-double-light: darkgreen; $bash-name-builtin-light: teal; $shell-prompt-light: dimgray; $ansi-green-light: darkgreen; +$ansi-gray-light: dimgray; $ansi-bright-cyan-light: #35bbc7; $ansi-bright-green-light: #33bd25; $ansi-bright-red-light: #c33820; @@ -110,6 +111,7 @@ $bash-literal-string-double-dark: forestgreen; $bash-name-builtin-dark: #ff8000; $shell-prompt-dark: dimgray; $ansi-green-dark: #00c300; +$ansi-gray-dark: dimgray; $ansi-bright-cyan-dark: cyan; $ansi-bright-green-dark: lime; $ansi-bright-red-dark: #ff6e67; @@ -170,6 +172,7 @@ $hurl-structure-3-back-dark: $code-background-color-dark; --bash-name-builtin: #{$bash-name-builtin-light}; --shell-prompt: #{$shell-prompt-light}; --ansi-green: #{$ansi-green-light}; + --ansi-gray: #{$ansi-gray-light}; --ansi-bright-cyan: #{$ansi-bright-cyan-light}; --ansi-bright-green: #{$ansi-bright-green-light}; --ansi-bright-red: #{$ansi-bright-red-light}; @@ -240,6 +243,7 @@ $hurl-structure-3-back-dark: $code-background-color-dark; --bash-name-builtin: #{$bash-name-builtin-dark}; --shell-prompt: #{$shell-prompt-dark}; --ansi-green: #{$ansi-green-dark}; + --ansi-gray: #{$ansi-gray-dark}; --ansi-bright-cyan: #{$ansi-bright-cyan-dark}; --ansi-bright-green: #{$ansi-bright-green-dark}; --ansi-bright-red: #{$ansi-bright-red-dark}; diff --git a/sites/hurl.dev/assets/img/emoji-smiling-face.avif b/sites/hurl.dev/assets/img/emoji-smiling-face.avif new file mode 100644 index 0000000..05a2567 Binary files /dev/null and b/sites/hurl.dev/assets/img/emoji-smiling-face.avif differ diff --git a/sites/hurl.dev/assets/img/emoji-smiling-face.png b/sites/hurl.dev/assets/img/emoji-smiling-face.png new file mode 100644 index 0000000..9539146 Binary files /dev/null and b/sites/hurl.dev/assets/img/emoji-smiling-face.png differ diff --git a/sites/hurl.dev/assets/img/emoji-smiling-face.webp b/sites/hurl.dev/assets/img/emoji-smiling-face.webp new file mode 100644 index 0000000..10f22db Binary files /dev/null and b/sites/hurl.dev/assets/img/emoji-smiling-face.webp differ diff --git a/sites/hurl.dev/assets/img/emoji-surfer.avif b/sites/hurl.dev/assets/img/emoji-surfer.avif new file mode 100644 index 0000000..e4903a2 Binary files /dev/null and b/sites/hurl.dev/assets/img/emoji-surfer.avif differ diff --git a/sites/hurl.dev/assets/img/emoji-surfer.png b/sites/hurl.dev/assets/img/emoji-surfer.png new file mode 100644 index 0000000..9507529 Binary files /dev/null and b/sites/hurl.dev/assets/img/emoji-surfer.png differ diff --git a/sites/hurl.dev/assets/img/emoji-surfer.webp b/sites/hurl.dev/assets/img/emoji-surfer.webp new file mode 100644 index 0000000..dbf96ad Binary files /dev/null and b/sites/hurl.dev/assets/img/emoji-surfer.webp differ diff --git a/sites/hurl.dev/assets/img/pinto-dark.avif b/sites/hurl.dev/assets/img/pinto-dark.avif new file mode 100644 index 0000000..a9dc7c8 Binary files /dev/null and b/sites/hurl.dev/assets/img/pinto-dark.avif differ diff --git a/sites/hurl.dev/assets/img/pinto-dark.png b/sites/hurl.dev/assets/img/pinto-dark.png new file mode 100644 index 0000000..0f7cbd0 Binary files /dev/null and b/sites/hurl.dev/assets/img/pinto-dark.png differ diff --git a/sites/hurl.dev/assets/img/pinto-dark.webp b/sites/hurl.dev/assets/img/pinto-dark.webp new file mode 100644 index 0000000..c63e0a0 Binary files /dev/null and b/sites/hurl.dev/assets/img/pinto-dark.webp differ diff --git a/sites/hurl.dev/assets/img/pinto-light.avif b/sites/hurl.dev/assets/img/pinto-light.avif new file mode 100644 index 0000000..8d88385 Binary files /dev/null and b/sites/hurl.dev/assets/img/pinto-light.avif differ diff --git a/sites/hurl.dev/assets/img/pinto-light.png b/sites/hurl.dev/assets/img/pinto-light.png new file mode 100644 index 0000000..c4c7320 Binary files /dev/null and b/sites/hurl.dev/assets/img/pinto-light.png differ diff --git a/sites/hurl.dev/assets/img/pinto-light.webp b/sites/hurl.dev/assets/img/pinto-light.webp new file mode 100644 index 0000000..163b099 Binary files /dev/null and b/sites/hurl.dev/assets/img/pinto-light.webp differ