Skip to content

Commit

Permalink
Patch generating README.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcamiel authored and hurl-bot committed Dec 4, 2024
1 parent 0f15b10 commit a7eb250
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 17 deletions.
34 changes: 31 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ HTTP 200
* [Templating a JSON Body](#templating-a-json-body)
* [Templating a XML Body](#templating-a-xml-body)
* [Using GraphQL Query](#using-graphql-query)
* [Using Dynamic Datas](#using-dynamic-datas)
* [Testing Response](#testing-response)
* [Testing Status Code](#testing-status-code)
* [Testing Response Headers](#testing-response-headers)
Expand Down Expand Up @@ -586,6 +587,32 @@ GraphQL queries can also use [Hurl templates].

[Doc](https://hurl.dev/docs/request.html#graphql-body)

### Using Dynamic Datas

[Functions] like `newUuid` and `newDate` can be used in templates to create dynamic datas:


A file that creates a dynamic email (i.e `[email protected]`):

```hurl
POST https://example.org/api/foo
{
"name": "foo",
"email": "{{newUuid}}@test.com"
}
```

A file that creates a dynamic query parameter (i.e `2024-12-02T10:35:44.461731Z`):

```hurl
GET https://example.org/api/foo
[QueryStringParams]
date: {{newDate}}
HTTP 200
```

[Doc](https://hurl.dev/docs/templates.html#functions)

## Testing Response

Responses are optional, everything after `HTTP` is part of the response asserts.
Expand Down Expand Up @@ -1524,9 +1551,9 @@ Please follow the [contrib on Windows section].
[GitHub]: https://github.com/Orange-OpenSource/hurl
[libcurl]: https://curl.se/libcurl/
[star Hurl on GitHub]: https://github.com/Orange-OpenSource/hurl/stargazers
[HTML]: /docs/standalone/hurl-5.0.1.html
[PDF]: /docs/standalone/hurl-5.0.1.pdf
[Markdown]: /docs/standalone/hurl-5.0.1.md
[HTML]: /docs/standalone/hurl-6.0.0.html
[PDF]: /docs/standalone/hurl-6.0.0.pdf
[Markdown]: /docs/standalone/hurl-6.0.0.md
[JSON body]: https://hurl.dev/docs/request.html#json-body
[XML body]: https://hurl.dev/docs/request.html#xml-body
[XML multiline string body]: https://hurl.dev/docs/request.html#multiline-string-body
Expand All @@ -1548,6 +1575,7 @@ Please follow the [contrib on Windows section].
[`--json` option]: https://hurl.dev/docs/manual.html#json
[`--resolve`]: https://hurl.dev/docs/manual.html#resolve
[`--connect-to`]: https://hurl.dev/docs/manual.html#connect-to
[Functions]: https://hurl.dev/docs/templates.html#functions
[GitHub]: https://github.com/Orange-OpenSource/hurl
[Hurl latest GitHub release]: https://github.com/Orange-OpenSource/hurl/releases/latest
[Visual C++ Redistributable Package]: https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170#latest-microsoft-visual-c-redistributable-version
Expand Down
19 changes: 10 additions & 9 deletions bin/docs/build_readme.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,20 +138,21 @@ def replace(text: str, dest: str) -> str:
</picture>
""",
),
# TODO: extract version from Cargo.toml
(
"[HTML]: /docs/standalone/hurl-5.0.1.html",
"[HTML]: /docs/standalone/hurl-5.0.1.html",
"[HTML]: https://hurl.dev/assets/docs/hurl-5.0.1.html.gz",
"[HTML]: /docs/standalone/hurl-6.0.0.html",
"[HTML]: /docs/standalone/hurl-6.0.0.html",
"[HTML]: https://hurl.dev/assets/docs/hurl-6.0.0.html.gz",
),
(
"[PDF]: /docs/standalone/hurl-5.0.1.pdf",
"[PDF]: /docs/standalone/hurl-5.0.1.pdf",
"[PDF]: https://hurl.dev/assets/docs/hurl-5.0.1.pdf.gz",
"[PDF]: /docs/standalone/hurl-6.0.0.pdf",
"[PDF]: /docs/standalone/hurl-6.0.0.pdf",
"[PDF]: https://hurl.dev/assets/docs/hurl-6.0.0.pdf.gz",
),
(
"[Markdown]: https://hurl.dev/docs/standalone/hurl-5.0.1.html",
"[Markdown]: /docs/standalone/hurl-5.0.1.md",
"[Markdown]: https://hurl.dev/assets/docs/hurl-5.0.1.md.gz",
"[Markdown]: https://hurl.dev/docs/standalone/hurl-6.0.0.html",
"[Markdown]: /docs/standalone/hurl-6.0.0.md",
"[Markdown]: https://hurl.dev/assets/docs/hurl-6.0.0.md.gz",
),
]
for old, new_for_github, new_for_crates in snippets:
Expand Down
2 changes: 1 addition & 1 deletion docs/manual/hurl.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH hurl 1 "07 Nov 2024" "hurl 6.0.0-SNAPSHOT" " Hurl Manual"
.TH hurl 1 "03 Dec 2024" "hurl 6.0.0-SNAPSHOT" " Hurl Manual"
.SH NAME

hurl - run and test HTTP requests.
Expand Down
2 changes: 1 addition & 1 deletion docs/manual/hurlfmt.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH hurl 1 "07 Nov 2024" "hurl 6.0.0-SNAPSHOT" " Hurl Manual"
.TH hurl 1 "03 Dec 2024" "hurl 6.0.0-SNAPSHOT" " Hurl Manual"
.SH NAME

hurlfmt - format Hurl files
Expand Down
34 changes: 31 additions & 3 deletions packages/hurl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ HTTP 200
* [Templating a JSON Body](#templating-a-json-body)
* [Templating a XML Body](#templating-a-xml-body)
* [Using GraphQL Query](#using-graphql-query)
* [Using Dynamic Datas](#using-dynamic-datas)
* [Testing Response](#testing-response)
* [Testing Status Code](#testing-status-code)
* [Testing Response Headers](#testing-response-headers)
Expand Down Expand Up @@ -586,6 +587,32 @@ GraphQL queries can also use [Hurl templates].

[Doc](https://hurl.dev/docs/request.html#graphql-body)

### Using Dynamic Datas

[Functions] like `newUuid` and `newDate` can be used in templates to create dynamic datas:


A file that creates a dynamic email (i.e `[email protected]`):

```hurl
POST https://example.org/api/foo
{
"name": "foo",
"email": "{{newUuid}}@test.com"
}
```

A file that creates a dynamic query parameter (i.e `2024-12-02T10:35:44.461731Z`):

```hurl
GET https://example.org/api/foo
[QueryStringParams]
date: {{newDate}}
HTTP 200
```

[Doc](https://hurl.dev/docs/templates.html#functions)

## Testing Response

Responses are optional, everything after `HTTP` is part of the response asserts.
Expand Down Expand Up @@ -1524,9 +1551,9 @@ Please follow the [contrib on Windows section].
[GitHub]: https://github.com/Orange-OpenSource/hurl
[libcurl]: https://curl.se/libcurl/
[star Hurl on GitHub]: https://github.com/Orange-OpenSource/hurl/stargazers
[HTML]: https://hurl.dev/assets/docs/hurl-5.0.1.html.gz
[PDF]: https://hurl.dev/assets/docs/hurl-5.0.1.pdf.gz
[Markdown]: https://hurl.dev/assets/docs/hurl-5.0.1.md.gz
[HTML]: https://hurl.dev/assets/docs/hurl-6.0.0.html.gz
[PDF]: https://hurl.dev/assets/docs/hurl-6.0.0.pdf.gz
[Markdown]: https://hurl.dev/assets/docs/hurl-6.0.0.md.gz
[JSON body]: https://hurl.dev/docs/request.html#json-body
[XML body]: https://hurl.dev/docs/request.html#xml-body
[XML multiline string body]: https://hurl.dev/docs/request.html#multiline-string-body
Expand All @@ -1548,6 +1575,7 @@ Please follow the [contrib on Windows section].
[`--json` option]: https://hurl.dev/docs/manual.html#json
[`--resolve`]: https://hurl.dev/docs/manual.html#resolve
[`--connect-to`]: https://hurl.dev/docs/manual.html#connect-to
[Functions]: https://hurl.dev/docs/templates.html#functions
[GitHub]: https://github.com/Orange-OpenSource/hurl
[Hurl latest GitHub release]: https://github.com/Orange-OpenSource/hurl/releases/latest
[Visual C++ Redistributable Package]: https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170#latest-microsoft-visual-c-redistributable-version
Expand Down

0 comments on commit a7eb250

Please sign in to comment.