Use long options for curl command

This commit is contained in:
lepapareil 2023-02-06 14:20:01 +01:00
parent ad999b2220
commit 4bbcfb1337
No known key found for this signature in database
GPG Key ID: F4F06B068FB00692
38 changed files with 124 additions and 123 deletions

View File

@ -8,7 +8,7 @@ Precompiled binary is available at [hurl-2.0.1-x86_64-linux.tar.gz]:
```shell
$ INSTALL_DIR=/tmp
$ curl -sL https://github.com/Orange-OpenSource/hurl/releases/download/2.0.1/hurl-2.0.1-x86_64-linux.tar.gz | tar xvz -C $INSTALL_DIR
$ curl -silent --location https://github.com/Orange-OpenSource/hurl/releases/download/2.0.1/hurl-2.0.1-x86_64-linux.tar.gz | tar xvz -C $INSTALL_DIR
$ export PATH=$INSTALL_DIR/hurl-2.0.1:$PATH
```
@ -17,7 +17,7 @@ $ export PATH=$INSTALL_DIR/hurl-2.0.1:$PATH
For Debian / Ubuntu, Hurl can be installed using a binary .deb file provided in each Hurl release.
```shell
$ curl -LO https://github.com/Orange-OpenSource/hurl/releases/download/2.0.1/hurl_2.0.1_amd64.deb
$ curl --location --remote-name https://github.com/Orange-OpenSource/hurl/releases/download/2.0.1/hurl_2.0.1_amd64.deb
$ sudo apt update && apt install ./hurl_2.0.1_amd64.deb
```
@ -168,5 +168,3 @@ Please follow the [contrib on Windows section].
[contrib on Windows section]: https://github.com/Orange-OpenSource/hurl/blob/master/contrib/windows/README.md
[NixOS / Nix package]: https://search.nixos.org/packages?from=0&size=1&sort=relevance&type=packages&query=hurl

View File

@ -215,7 +215,7 @@ jobs:
run: echo "Building app..."
- name: Integration test
run: |
curl -LO https://github.com/Orange-OpenSource/hurl/releases/download/1.4.0/hurl_1.4.0_amd64.deb
curl --location --remote-name https://github.com/Orange-OpenSource/hurl/releases/download/1.4.0/hurl_1.4.0_amd64.deb
sudo dpkg -i hurl_1.4.0_amd64.deb
bin/integration.sh
```
@ -264,4 +264,4 @@ Now, we can add more Hurl tests and start developing new features with confidenc
[GitLab CI/CD here]: https://about.gitlab.com/blog/2022/12/14/how-to-continously-test-web-apps-apis-with-hurl-and-gitlab-ci-cd/
[GitLab CI/CD]: https://about.gitlab.com/why-gitlab/
[this detailed tutorial]: https://about.gitlab.com/blog/2022/12/14/how-to-continously-test-web-apps-apis-with-hurl-and-gitlab-ci-cd/
[`--retry`]: /docs/manual.md#retry
[`--retry`]: /docs/manual.md#retry

View File

@ -1,3 +1,3 @@
curl 'http://bob%40email.com:secret@localhost:8000/basic-authentication-per-request'
curl -H 'Authorization: Basic Ym9iQGVtYWlsLmNvbTpzZWNyZXQ=' 'http://localhost:8000/basic-authentication-per-request'
curl -H 'Authorization: Basic Ym9iQGVtYWlsLmNvbTpzZWNyZXQ=' 'http://localhost:8000/basic-authentication-per-request'
curl --header 'Authorization: Basic Ym9iQGVtYWlsLmNvbTpzZWNyZXQ=' 'http://localhost:8000/basic-authentication-per-request'
curl --header 'Authorization: Basic Ym9iQGVtYWlsLmNvbTpzZWNyZXQ=' 'http://localhost:8000/basic-authentication-per-request'

View File

@ -1,2 +1,2 @@
curl 'http://localhost:8000/utf8_bom'
curl -H 'Content-Type:' --data '@tests_ok/bom.hurl' 'http://localhost:8000/mirror'
curl --header 'Content-Type:' --data '@tests_ok/bom.hurl' 'http://localhost:8000/mirror'

View File

@ -1,2 +1,2 @@
curl 'http://localhost:8000/utf8_bom'
curl -H 'Content-Type:' --data '@tests_ok\bom.hurl' 'http://localhost:8000/mirror'
curl --header 'Content-Type:' --data '@tests_ok\bom.hurl' 'http://localhost:8000/mirror'

View File

@ -1,2 +1,2 @@
curl -X DELETE 'http://localhost:8000/delete'
curl --request DELETE 'http://localhost:8000/delete'

View File

@ -1 +1 @@
curl -H 'Expect: 100-continue' -H 'Content-Type:' --data 'data' 'http://localhost:8000/expect'
curl --header 'Expect: 100-continue' --header 'Content-Type:' --data 'data' 'http://localhost:8000/expect'

View File

@ -1 +1 @@
curl -L 'http://localhost:8000/follow-redirect'
curl --location 'http://localhost:8000/follow-redirect'

View File

@ -1 +1 @@
-L
--location

View File

@ -1,2 +1,2 @@
curl --data 'param1=value1' --data 'param2=' --data 'param3=a%3Db' --data 'param4=a%253db' --data 'values[0]=0' --data 'values[1]=1' 'http://localhost:8000/form-params'
curl -H 'Content-Type: application/x-www-form-urlencoded' --data 'param1=value1&param2=&param3=a%3db&param4=a%253db&values[0]=0&values[1]=1' 'http://localhost:8000/form-params'
curl --header 'Content-Type: application/x-www-form-urlencoded' --data 'param1=value1&param2=&param3=a%3db&param4=a%253db&values[0]=0&values[1]=1' 'http://localhost:8000/form-params'

View File

@ -1,5 +1,5 @@
curl -H 'Content-Type: application/json' --data '{"query":"{\n allFilms {\n films {\n title\n director\n releaseDate\n }\n }\n}"}' 'http://localhost:8000/graphql'
curl -H 'Content-Type: application/json' --data '{"query":"{\n allFilms {\n films {\n title\n director\n releaseDate\n }\n }\n}"}' 'http://localhost:8000/graphql'
curl -H 'Content-Type: application/json' --data '{"query":"query Query {\n allFilms {\n films {\n title\n director\n releaseDate\n }\n }\n}"}' 'http://localhost:8000/graphql'
curl -H 'Content-Type: application/json' --data '{"query":"query Person($id: ID!) {\n person(id: $id) {\n name\n }\n}","variables":{"id":"cGVvcGxlOjQ="}}' 'http://localhost:8000/graphql'
curl -H 'Content-Type: application/json' --data '{"query":"query Person($id: ID!) {\n person(id: $id) {\n name\n }\n}","variables":{"id":"cGVvcGxlOjQ="}}' 'http://localhost:8000/graphql'
curl --header 'Content-Type: application/json' --data '{"query":"{\n allFilms {\n films {\n title\n director\n releaseDate\n }\n }\n}"}' 'http://localhost:8000/graphql'
curl --header 'Content-Type: application/json' --data '{"query":"{\n allFilms {\n films {\n title\n director\n releaseDate\n }\n }\n}"}' 'http://localhost:8000/graphql'
curl --header 'Content-Type: application/json' --data '{"query":"query Query {\n allFilms {\n films {\n title\n director\n releaseDate\n }\n }\n}"}' 'http://localhost:8000/graphql'
curl --header 'Content-Type: application/json' --data '{"query":"query Person($id: ID!) {\n person(id: $id) {\n name\n }\n}","variables":{"id":"cGVvcGxlOjQ="}}' 'http://localhost:8000/graphql'
curl --header 'Content-Type: application/json' --data '{"query":"query Person($id: ID!) {\n person(id: $id) {\n name\n }\n}","variables":{"id":"cGVvcGxlOjQ="}}' 'http://localhost:8000/graphql'

View File

@ -1,7 +1,7 @@
curl 'http://localhost:8000/default-headers'
curl 'http://localhost:8000/default-headers' -H 'User-Agent: hurl/1.0' -H 'Host: localhost:8000'
curl 'http://localhost:8000/default-headers' -H 'User-Agent: hurl/1.0' -H 'Host: localhost:8000'
curl 'http://localhost:8000/custom-headers' -H 'Fruit: Raspberry' -H 'Fruit: Apple' -H 'Fruit: Banana' -H 'Fruit: Grape' -H 'Color: Green'
curl 'http://localhost:8000/custom-headers-utf8' -H 'Beverage: café'
curl 'http://localhost:8000/custom-headers-quote' -H $'Header1: \''
curl 'http://localhost:8000/default-headers' --header 'User-Agent: hurl/1.0' --header 'Host: localhost:8000'
curl 'http://localhost:8000/default-headers' --header 'User-Agent: hurl/1.0' --header 'Host: localhost:8000'
curl 'http://localhost:8000/custom-headers' --header 'Fruit: Raspberry' --header 'Fruit: Apple' --header 'Fruit: Banana' --header 'Fruit: Grape' --header 'Color: Green'
curl 'http://localhost:8000/custom-headers-utf8' --header 'Beverage: café'
curl 'http://localhost:8000/custom-headers-quote' --header $'Header1: \''
curl 'http://localhost:8000/response-headers'

View File

@ -1,6 +1,6 @@
curl 'http://localhost:8000/hello'
curl 'http://localhost:8000/cookies/set-session-cookie2-valueA'
curl --cookie 'cookie2=valueA' 'http://localhost:8000/follow-redirect'
curl --cookie 'cookie2=valueA' -L 'http://localhost:8000/follow-redirect'
curl --cookie 'cookie2=valueA' --location 'http://localhost:8000/follow-redirect'
curl --cookie 'cookie2=valueA' 'http://localhost:8000/captures'
curl --cookie 'cookie2=valueA' 'http://localhost:8000/assert-json'

View File

@ -1,16 +1,16 @@
curl 'http://localhost:8000/methods/get'
curl --head 'http://localhost:8000/methods/head'
curl -X POST 'http://localhost:8000/methods/post'
curl -X PUT 'http://localhost:8000/methods/put'
curl -X DELETE 'http://localhost:8000/methods/delete'
curl -X CONNECT 'http://localhost:8000/methods/connect'
curl -X OPTIONS 'http://localhost:8000/methods/options'
curl -X TRACE 'http://localhost:8000/methods/trace'
curl -X PATCH 'http://localhost:8000/methods/patch'
curl -X LINK 'http://localhost:8000/methods/link'
curl -X UNLINK 'http://localhost:8000/methods/unlink'
curl -X PURGE 'http://localhost:8000/methods/purge'
curl -X LOCK 'http://localhost:8000/methods/lock'
curl -X UNLOCK 'http://localhost:8000/methods/unlock'
curl -X PROPFIND 'http://localhost:8000/methods/propfind'
curl -X VIEW 'http://localhost:8000/methods/view'
curl --request POST 'http://localhost:8000/methods/post'
curl --request PUT 'http://localhost:8000/methods/put'
curl --request DELETE 'http://localhost:8000/methods/delete'
curl --request CONNECT 'http://localhost:8000/methods/connect'
curl --request OPTIONS 'http://localhost:8000/methods/options'
curl --request TRACE 'http://localhost:8000/methods/trace'
curl --request PATCH 'http://localhost:8000/methods/patch'
curl --request LINK 'http://localhost:8000/methods/link'
curl --request UNLINK 'http://localhost:8000/methods/unlink'
curl --request PURGE 'http://localhost:8000/methods/purge'
curl --request LOCK 'http://localhost:8000/methods/lock'
curl --request UNLOCK 'http://localhost:8000/methods/unlock'
curl --request PROPFIND 'http://localhost:8000/methods/propfind'
curl --request VIEW 'http://localhost:8000/methods/view'

View File

@ -1,4 +1,4 @@
curl -H 'Content-Type:' --data $'line1\nline2\nline3\n' 'http://localhost:8000/multilines/plain-text'
curl -H 'Content-Type: application/json' --data $'{\n "foo": "bar"\n "baz": 123456\n}\n' 'http://localhost:8000/multilines/json'
curl -H 'Content-Type: application/xml' --data $'<?xml version="1.0"?>\n<catalog>\n <book id="bk101">\n <author>Gambardella, Matthew</author>\n <title>XML Developer\'s Guide</title>\n <genre>Computer</genre>\n <price>44.95</price>\n <publish_date>2000-10-01</publish_date>\n <description>An in-depth look at creating applications\n with XML.</description>\n </book>\n</catalog>\n' 'http://localhost:8000/multilines/xml'
curl -H 'Content-Type: application/json' --data '{"query":"{\n hero {\n name\n # Queries can have comments!\n friends {\n name\n }\n }\n}"}' 'http://localhost:8000/multilines/graphql'
curl --header 'Content-Type:' --data $'line1\nline2\nline3\n' 'http://localhost:8000/multilines/plain-text'
curl --header 'Content-Type: application/json' --data $'{\n "foo": "bar"\n "baz": 123456\n}\n' 'http://localhost:8000/multilines/json'
curl --header 'Content-Type: application/xml' --data $'<?xml version="1.0"?>\n<catalog>\n <book id="bk101">\n <author>Gambardella, Matthew</author>\n <title>XML Developer\'s Guide</title>\n <genre>Computer</genre>\n <price>44.95</price>\n <publish_date>2000-10-01</publish_date>\n <description>An in-depth look at creating applications\n with XML.</description>\n </book>\n</catalog>\n' 'http://localhost:8000/multilines/xml'
curl --header 'Content-Type: application/json' --data '{"query":"{\n hero {\n name\n # Queries can have comments!\n friends {\n name\n }\n }\n}"}' 'http://localhost:8000/multilines/graphql'

View File

@ -1 +1 @@
curl -F 'key1=value1' -F 'upload1=@tests_ok/data.txt;type=text/plain' -F 'upload2=@tests_ok/data.html;type=text/html' -F 'upload3=@tests_ok/data.txt;type=text/html' 'http://localhost:8000/multipart-form-data'
curl --form 'key1=value1' --form 'upload1=@tests_ok/data.txt;type=text/plain' --form 'upload2=@tests_ok/data.html;type=text/html' --form 'upload3=@tests_ok/data.txt;type=text/html' 'http://localhost:8000/multipart-form-data'

View File

@ -1 +1 @@
curl -F 'key1=value1' -F 'upload1=@tests_ok\data.txt;type=text/plain' -F 'upload2=@tests_ok\data.html;type=text/html' -F 'upload3=@tests_ok\data.txt;type=text/html' 'http://localhost:8000/multipart-form-data'
curl --form 'key1=value1' --form 'upload1=@tests_ok\data.txt;type=text/plain' --form 'upload2=@tests_ok\data.html;type=text/html' --form 'upload3=@tests_ok\data.txt;type=text/html' 'http://localhost:8000/multipart-form-data'

View File

@ -1,3 +1,3 @@
curl 'http://localhost:8000/follow-redirect'
curl 'http://localhost:8000/follow-redirect'
curl -L 'http://localhost:8000/follow-redirect'
curl --location 'http://localhost:8000/follow-redirect'

View File

@ -14,7 +14,7 @@
* POST http://localhost:8000/jobs
*
* Request can be run with the following curl command:
* curl -X POST 'http://localhost:8000/jobs'
* curl --request POST 'http://localhost:8000/jobs'
*
> POST /jobs HTTP/1.1
> Host: localhost:8000
@ -222,7 +222,7 @@
* DELETE http://localhost:8000/jobs/~~~
*
* Request can be run with the following curl command:
* curl -X DELETE 'http://localhost:8000/jobs/~~~'
* curl --request DELETE 'http://localhost:8000/jobs/~~~'
*
> DELETE /jobs/~~~ HTTP/1.1
> Host: localhost:8000

View File

@ -1 +1 @@
curl -X PATCH -H 'Host: www.example.com' -H 'Content-Type: application/example' -H 'If-Match: "e0023aa4e"' 'http://localhost:8000/patch/file.txt'
curl --request PATCH --header 'Host: www.example.com' --header 'Content-Type: application/example' --header 'If-Match: "e0023aa4e"' 'http://localhost:8000/patch/file.txt'

View File

@ -1 +1 @@
curl -H 'Content-Type: application/octet-stream' --data $'\x48\x65\x6c\x6c\x6f\x20\x57\x6f\x72\x6c\x64\x21' 'http://localhost:8000/post-base64'
curl --header 'Content-Type: application/octet-stream' --data $'\x48\x65\x6c\x6c\x6f\x20\x57\x6f\x72\x6c\x64\x21' 'http://localhost:8000/post-base64'

View File

@ -1 +1 @@
curl -H 'Content-Type: application/octet-stream' --data $'\x01\x02\x03' 'http://localhost:8000/post-bytes'
curl --header 'Content-Type: application/octet-stream' --data $'\x01\x02\x03' 'http://localhost:8000/post-bytes'

View File

@ -1,2 +1,2 @@
curl -H 'Content-Type:' --data '@tests_ok/data.bin' 'http://localhost:8000/post-file'
curl -H 'Content-Type:' --data '@tests_ok/post_file_with space' 'http://localhost:8000/post-file'
curl --header 'Content-Type:' --data '@tests_ok/data.bin' 'http://localhost:8000/post-file'
curl --header 'Content-Type:' --data '@tests_ok/post_file_with space' 'http://localhost:8000/post-file'

View File

@ -1,2 +1,2 @@
curl -H 'Content-Type:' --data '@tests_ok\data.bin' 'http://localhost:8000/post-file'
curl -H 'Content-Type:' --data '@tests_ok\post_file_with space' 'http://localhost:8000/post-file'
curl --header 'Content-Type:' --data '@tests_ok\data.bin' 'http://localhost:8000/post-file'
curl --header 'Content-Type:' --data '@tests_ok\post_file_with space' 'http://localhost:8000/post-file'

View File

@ -1,8 +1,8 @@
curl -H 'Content-Type: application/json' --data $'{\n "name": "Bob",\n "password": "&secret\\\\\'<>",\n "age": 30,\n "strict": true,\n "spacing": "\\n",\n "g_clef": "\\uD834\\uDD1E",\n "items": [true, "true", 1],\n "variable": "\\\\"\n}' 'http://localhost:8000/post-json'
curl -H 'Content-Type: application/json' --data '[1,2,3]' 'http://localhost:8000/post-json-array'
curl -H 'Content-Type: application/json' --data '"Hello"' 'http://localhost:8000/post-json-string'
curl -H 'Content-Type: application/json' --data '100' 'http://localhost:8000/post-json-number'
curl -H 'Content-Type: application/json' --data $'{\n "natural": 100,\n "negative": -1,\n "float": "3.333333333333333",\n "exponent": 100e100\n}' 'http://localhost:8000/post-json-numbers'
curl -H 'Content-Type: application/json' --data 'true' 'http://localhost:8000/post-json-boolean'
curl --header 'Content-Type: application/json' --data $'{\n "name": "Bob",\n "password": "&secret\\\\\'<>",\n "age": 30,\n "strict": true,\n "spacing": "\\n",\n "g_clef": "\\uD834\\uDD1E",\n "items": [true, "true", 1],\n "variable": "\\\\"\n}' 'http://localhost:8000/post-json'
curl --header 'Content-Type: application/json' --data '[1,2,3]' 'http://localhost:8000/post-json-array'
curl --header 'Content-Type: application/json' --data '"Hello"' 'http://localhost:8000/post-json-string'
curl --header 'Content-Type: application/json' --data '100' 'http://localhost:8000/post-json-number'
curl --header 'Content-Type: application/json' --data $'{\n "natural": 100,\n "negative": -1,\n "float": "3.333333333333333",\n "exponent": 100e100\n}' 'http://localhost:8000/post-json-numbers'
curl --header 'Content-Type: application/json' --data 'true' 'http://localhost:8000/post-json-boolean'
curl 'http://localhost:8000/get-name'
curl -H 'Content-Type: application/json' --data $'{\n "name": "Bob"\n}' 'http://localhost:8000/check_name'
curl --header 'Content-Type: application/json' --data $'{\n "name": "Bob"\n}' 'http://localhost:8000/check_name'

View File

@ -1,3 +1,3 @@
curl -H 'Content-Type:' --data $'name,age\nbob,10\nbill,22\n' 'http://localhost:8000/post-multilines'
curl --header 'Content-Type:' --data $'name,age\nbob,10\nbill,22\n' 'http://localhost:8000/post-multilines'
curl 'http://localhost:8000/get-bob-age'
curl -H 'Content-Type:' --data $'name,age\nbob,10\nbill,22\n' 'http://localhost:8000/post-multilines'
curl --header 'Content-Type:' --data $'name,age\nbob,10\nbill,22\n' 'http://localhost:8000/post-multilines'

View File

@ -1,2 +1,2 @@
curl 'http://localhost:8000/post-xml' -H 'Content-Type: application/xml' --data $'<?xml version="1.0"?>\n<drink>café</drink>'
curl 'http://localhost:8000/post-xml-no-prolog' -H 'Content-Type: application/xml' --data '<drink>café</drink>'
curl 'http://localhost:8000/post-xml' --header 'Content-Type: application/xml' --data $'<?xml version="1.0"?>\n<drink>café</drink>'
curl 'http://localhost:8000/post-xml-no-prolog' --header 'Content-Type: application/xml' --data '<drink>café</drink>'

View File

@ -1 +1 @@
curl -X PUT 'http://localhost:8000/put'
curl --request PUT 'http://localhost:8000/put'

View File

@ -1,5 +1,5 @@
curl 'http://localhost:8000/redirected'
curl 'http://localhost:8000/redirect-absolute'
curl -L 'http://localhost:8000/redirect-absolute'
curl --location 'http://localhost:8000/redirect-absolute'
curl 'http://localhost:8000/redirect-relative'
curl -L 'http://localhost:8000/redirect-relative'
curl --location 'http://localhost:8000/redirect-relative'

View File

@ -14,7 +14,7 @@
* POST http://localhost:8000/jobs
*
* Request can be run with the following curl command:
* curl -X POST 'http://localhost:8000/jobs'
* curl --request POST 'http://localhost:8000/jobs'
*
> POST /jobs HTTP/1.1
> Host: localhost:8000
@ -202,7 +202,7 @@
* DELETE http://localhost:8000/jobs/~~~
*
* Request can be run with the following curl command:
* curl -X DELETE 'http://localhost:8000/jobs/~~~'
* curl --request DELETE 'http://localhost:8000/jobs/~~~'
*
> DELETE /jobs/~~~ HTTP/1.1
> Host: localhost:8000

View File

@ -1,3 +1,3 @@
curl -H 'Name: Jennifer' -H 'Age: 30' -H 'Height: 1.7' -H 'Female: true' -H 'Id: 123' -H 'A_Null: null' -H 'Country: Italy' -H 'Planet: The Earth' -H 'Galaxy: Milky Way' -H 'Content-Type: application/json' --data $'{\n "name": "Jennifer",\n "age": 30,\n "height": 1.7,\n "female": true,\n "id": "123",\n "a_null": null,\n "country": "Italy",\n "planet": "The Earth",\n "galaxy": "Milky Way"\n}' 'http://localhost:8000/variables'
curl --header 'Name: Jennifer' --header 'Age: 30' --header 'Height: 1.7' --header 'Female: true' --header 'Id: 123' --header 'A_Null: null' --header 'Country: Italy' --header 'Planet: The Earth' --header 'Galaxy: Milky Way' --header 'Content-Type: application/json' --data $'{\n "name": "Jennifer",\n "age": 30,\n "height": 1.7,\n "female": true,\n "id": "123",\n "a_null": null,\n "country": "Italy",\n "planet": "The Earth",\n "galaxy": "Milky Way"\n}' 'http://localhost:8000/variables'
curl 'http://localhost:8000/variable/country'
curl 'http://localhost:8000/variable/planet'

View File

@ -1,6 +1,6 @@
curl -L 'http://localhost:8000/very-verbose/redirect'
curl -L 'http://localhost:8000/very-verbose/encoding/latin1'
curl -H 'Accept-Encoding: brotli' -H 'Content-Type: application/json' --data $'{\n "foo": "bar",\n "baz": true\n}' -L 'http://localhost:8000/very-verbose/compressed/brotli'
curl -L 'http://localhost:8000/very-verbose/cat'
curl -F 'cat=@tests_ok/cat.jpg;type=image/jpeg' -L 'http://localhost:8000/very-verbose/update-cat'
curl -H 'x-foo: bar' -L 'http://localhost:8000/very-verbose/done'
curl --location 'http://localhost:8000/very-verbose/redirect'
curl --location 'http://localhost:8000/very-verbose/encoding/latin1'
curl --header 'Accept-Encoding: brotli' --header 'Content-Type: application/json' --data $'{\n "foo": "bar",\n "baz": true\n}' --location 'http://localhost:8000/very-verbose/compressed/brotli'
curl --location 'http://localhost:8000/very-verbose/cat'
curl --form 'cat=@tests_ok/cat.jpg;type=image/jpeg' --location 'http://localhost:8000/very-verbose/update-cat'
curl --header 'x-foo: bar' --location 'http://localhost:8000/very-verbose/done'

View File

@ -14,7 +14,7 @@
* GET http://localhost:8000/very-verbose/redirect
*
* Request can be run with the following curl command:
* curl -L 'http://localhost:8000/very-verbose/redirect'
* curl --location 'http://localhost:8000/very-verbose/redirect'
*
** Trying 127.0.0.1:8000...
** Connected to localhost (127.0.0.1) port 8000 (#0)
@ -85,7 +85,7 @@
* GET http://localhost:8000/very-verbose/encoding/latin1
*
* Request can be run with the following curl command:
* curl -L 'http://localhost:8000/very-verbose/encoding/latin1'
* curl --location 'http://localhost:8000/very-verbose/encoding/latin1'
*
** Hostname localhost was found in DNS cache
** Trying 127.0.0.1:8000...
@ -123,7 +123,7 @@
* Implicit content-type=application/json
*
* Request can be run with the following curl command:
* curl -H 'Accept-Encoding: brotli' -H 'Content-Type: application/json' --data $'{\n "foo": "bar",\n "baz": true\n}' -L 'http://localhost:8000/very-verbose/compressed/brotli'
* curl --header 'Accept-Encoding: brotli' --header 'Content-Type: application/json' --data $'{\n "foo": "bar",\n "baz": true\n}' --location 'http://localhost:8000/very-verbose/compressed/brotli'
*
** Hostname localhost was found in DNS cache
** Trying 127.0.0.1:8000...
@ -166,7 +166,7 @@
* GET http://localhost:8000/very-verbose/cat
*
* Request can be run with the following curl command:
* curl -L 'http://localhost:8000/very-verbose/cat'
* curl --location 'http://localhost:8000/very-verbose/cat'
*
** Hostname localhost was found in DNS cache
** Trying 127.0.0.1:8000...
@ -205,7 +205,7 @@
* Implicit content-type=multipart/form-data
*
* Request can be run with the following curl command:
* curl -F 'cat=@tests_ok~cat.jpg;type=image/jpeg' -L 'http://localhost:8000/very-verbose/update-cat'
* curl --form 'cat=@tests_ok~cat.jpg;type=image/jpeg' --location 'http://localhost:8000/very-verbose/update-cat'
*
** Hostname localhost was found in DNS cache
** Trying 127.0.0.1:8000...
@ -244,7 +244,7 @@
* x-foo: bar
*
* Request can be run with the following curl command:
* curl -H 'x-foo: bar' -L 'http://localhost:8000/very-verbose/done'
* curl --header 'x-foo: bar' --location 'http://localhost:8000/very-verbose/done'
*
** Hostname localhost was found in DNS cache
** Trying 127.0.0.1:8000...

View File

@ -1,6 +1,6 @@
curl -L 'http://localhost:8000/very-verbose/redirect'
curl -L 'http://localhost:8000/very-verbose/encoding/latin1'
curl -H 'Accept-Encoding: brotli' -H 'Content-Type: application/json' --data $'{\n "foo": "bar",\n "baz": true\n}' -L 'http://localhost:8000/very-verbose/compressed/brotli'
curl -L 'http://localhost:8000/very-verbose/cat'
curl -F 'cat=@tests_ok\cat.jpg;type=image/jpeg' -L 'http://localhost:8000/very-verbose/update-cat'
curl -H 'x-foo: bar' -L 'http://localhost:8000/very-verbose/done'
curl --location 'http://localhost:8000/very-verbose/redirect'
curl --location 'http://localhost:8000/very-verbose/encoding/latin1'
curl --header 'Accept-Encoding: brotli' --header 'Content-Type: application/json' --data $'{\n "foo": "bar",\n "baz": true\n}' --location 'http://localhost:8000/very-verbose/compressed/brotli'
curl --location 'http://localhost:8000/very-verbose/cat'
curl --form 'cat=@tests_ok\cat.jpg;type=image/jpeg' --location 'http://localhost:8000/very-verbose/update-cat'
curl --header 'x-foo: bar' --location 'http://localhost:8000/very-verbose/done'

View File

@ -936,7 +936,7 @@ Precompiled binary is available at [hurl-2.0.1-x86_64-linux.tar.gz]:
```shell
$ INSTALL_DIR=/tmp
$ curl -sL https://github.com/Orange-OpenSource/hurl/releases/download/2.0.1/hurl-2.0.1-x86_64-linux.tar.gz | tar xvz -C $INSTALL_DIR
$ curl -silent --location https://github.com/Orange-OpenSource/hurl/releases/download/2.0.1/hurl-2.0.1-x86_64-linux.tar.gz | tar xvz -C $INSTALL_DIR
$ export PATH=$INSTALL_DIR/hurl-2.0.1:$PATH
```
@ -945,7 +945,7 @@ $ export PATH=$INSTALL_DIR/hurl-2.0.1:$PATH
For Debian / Ubuntu, Hurl can be installed using a binary .deb file provided in each Hurl release.
```shell
$ curl -LO https://github.com/Orange-OpenSource/hurl/releases/download/2.0.1/hurl_2.0.1_amd64.deb
$ curl --location --remote-name https://github.com/Orange-OpenSource/hurl/releases/download/2.0.1/hurl_2.0.1_amd64.deb
$ sudo apt update && apt install ./hurl_2.0.1_amd64.deb
```

View File

@ -108,7 +108,7 @@ impl ClientOptions {
arguments.push("--insecure".to_string());
}
if self.follow_location {
arguments.push("-L".to_string());
arguments.push("--location".to_string());
}
if self.max_redirect != ClientOptions::default().max_redirect {
let max_redirect = match self.max_redirect {
@ -185,7 +185,7 @@ mod tests {
"--cookie".to_string(),
"cookie_file".to_string(),
"--insecure".to_string(),
"-L".to_string(),
"--location".to_string(),
"--max-redirs".to_string(),
"10".to_string(),
"--proxy".to_string(),

View File

@ -45,21 +45,21 @@ impl RequestSpec {
if content_type.as_str() != "application/x-www-form-urlencoded"
&& content_type.as_str() != "multipart/form-data"
{
arguments.push("-H".to_string());
arguments.push("--header".to_string());
arguments.push(format!("'Content-Type: {content_type}'"));
}
} else if !self.body.bytes().is_empty() {
match self.body.clone() {
Body::Text(_) => {
arguments.push("-H".to_string());
arguments.push("--header".to_string());
arguments.push("'Content-Type:'".to_string())
}
Body::Binary(_) => {
arguments.push("-H".to_string());
arguments.push("--header".to_string());
arguments.push("'Content-Type: application/octet-stream'".to_string())
}
Body::File(_, _) => {
arguments.push("-H".to_string());
arguments.push("--header".to_string());
arguments.push("'Content-Type:'".to_string())
}
}
@ -71,7 +71,7 @@ impl RequestSpec {
arguments.push(format!("'{}'", param.curl_arg_escape()));
}
for param in self.multipart.clone() {
arguments.push("-F".to_string());
arguments.push("--form".to_string());
arguments.push(format!("'{}'", param.curl_arg(context_dir)));
}
@ -116,7 +116,7 @@ impl Method {
match self {
Method::Get => {
if data {
vec!["-X".to_string(), "GET".to_string()]
vec!["--request".to_string(), "GET".to_string()]
} else {
vec![]
}
@ -126,10 +126,10 @@ impl Method {
if data {
vec![]
} else {
vec!["-X".to_string(), "POST".to_string()]
vec!["--request".to_string(), "POST".to_string()]
}
}
_ => vec!["-X".to_string(), self.to_string()],
_ => vec!["--request".to_string(), self.to_string()],
}
}
}
@ -139,7 +139,7 @@ impl Header {
let name = self.name.clone();
let value = self.value.clone();
vec![
"-H".to_string(),
"--header".to_string(),
encode_shell_string(format!("{name}: {value}").as_str()),
]
}
@ -248,22 +248,22 @@ pub mod tests {
assert!(Method::Get.curl_args(false).is_empty());
assert_eq!(
Method::Get.curl_args(true),
vec!["-X".to_string(), "GET".to_string()]
vec!["--request".to_string(), "GET".to_string()]
);
assert_eq!(
Method::Post.curl_args(false),
vec!["-X".to_string(), "POST".to_string()]
vec!["--request".to_string(), "POST".to_string()]
);
assert!(Method::Post.curl_args(true).is_empty());
assert_eq!(
Method::Put.curl_args(false),
vec!["-X".to_string(), "PUT".to_string()]
vec!["--request".to_string(), "PUT".to_string()]
);
assert_eq!(
Method::Put.curl_args(true),
vec!["-X".to_string(), "PUT".to_string()]
vec!["--request".to_string(), "PUT".to_string()]
);
}
@ -275,7 +275,7 @@ pub mod tests {
value: "example.com".to_string(),
}
.curl_args(),
vec!["-H".to_string(), "'Host: example.com'".to_string()]
vec!["--header".to_string(), "'Host: example.com'".to_string()]
);
assert_eq!(
Header {
@ -283,7 +283,10 @@ pub mod tests {
value: "\"e0023aa4e\"".to_string(),
}
.curl_args(),
vec!["-H".to_string(), "'If-Match: \"e0023aa4e\"'".to_string()]
vec![
"--header".to_string(),
"'If-Match: \"e0023aa4e\"'".to_string()
]
);
}
@ -333,9 +336,9 @@ pub mod tests {
assert_eq!(
custom_http_request().curl_args(context_dir),
vec![
"-H".to_string(),
"--header".to_string(),
"'User-Agent: iPhone'".to_string(),
"-H".to_string(),
"--header".to_string(),
"'Foo: Bar'".to_string(),
"'http://localhost/custom'".to_string(),
]
@ -349,7 +352,7 @@ pub mod tests {
assert_eq!(
form_http_request().curl_args(context_dir),
vec![
"-H".to_string(),
"--header".to_string(),
"'Content-Type: application/x-www-form-urlencoded'".to_string(),
"--data".to_string(),
"'param1=value1'".to_string(),

View File

@ -112,7 +112,7 @@ fn test_put() {
};
assert_eq!(
client.curl_command_line(&request_spec, &context_dir, &options),
"curl -X PUT 'http://localhost:8000/put'".to_string()
"curl --request PUT 'http://localhost:8000/put'".to_string()
);
let (request, response) = client.execute(&request_spec, &options, &logger).unwrap();
@ -164,7 +164,7 @@ fn test_patch() {
};
assert_eq!(
client.curl_command_line(&request_spec, &context_dir, &options),
"curl -X PATCH -H 'Host: www.example.com' -H 'Content-Type: application/example' -H 'If-Match: \"e0023aa4e\"' 'http://localhost:8000/patch/file.txt'".to_string()
"curl --request PATCH --header 'Host: www.example.com' --header 'Content-Type: application/example' --header 'If-Match: \"e0023aa4e\"' 'http://localhost:8000/patch/file.txt'".to_string()
);
let (request, response) = client.execute(&request_spec, &options, &logger).unwrap();
@ -218,7 +218,7 @@ fn test_custom_headers() {
assert!(options.curl_args().is_empty());
assert_eq!(
client.curl_command_line(&request_spec, &context_dir, &options),
"curl -H 'Fruit: Raspberry' -H 'Fruit: Apple' -H 'Fruit: Banana' -H 'Fruit: Grape' -H 'Color: Green' 'http://localhost:8000/custom-headers'".to_string()
"curl --header 'Fruit: Raspberry' --header 'Fruit: Apple' --header 'Fruit: Banana' --header 'Fruit: Grape' --header 'Color: Green' 'http://localhost:8000/custom-headers'".to_string()
);
let (request, response) = client.execute(&request_spec, &options, &logger).unwrap();
@ -410,10 +410,10 @@ fn test_follow_location() {
};
let context_dir = ContextDir::default();
let mut client = Client::new(None);
assert_eq!(options.curl_args(), vec!["-L".to_string()]);
assert_eq!(options.curl_args(), vec!["--location".to_string()]);
assert_eq!(
client.curl_command_line(&request_spec, &context_dir, &options),
"curl -L 'http://localhost:8000/redirect-absolute'".to_string()
"curl --location 'http://localhost:8000/redirect-absolute'".to_string()
);
let calls = client
@ -476,7 +476,7 @@ fn test_max_redirect() {
let request_spec = default_get_request("http://localhost:8000/redirect/15");
assert_eq!(
client.curl_command_line(&request_spec, &context_dir, &options),
"curl -L --max-redirs 10 'http://localhost:8000/redirect/15'".to_string()
"curl --location --max-redirs 10 'http://localhost:8000/redirect/15'".to_string()
);
let error = client
.execute_with_redirect(&request_spec, &options, &logger)
@ -487,7 +487,7 @@ fn test_max_redirect() {
let request_spec = default_get_request("http://localhost:8000/redirect/8");
assert_eq!(
client.curl_command_line(&request_spec, &context_dir, &options),
"curl -L --max-redirs 10 'http://localhost:8000/redirect/8'".to_string()
"curl --location --max-redirs 10 'http://localhost:8000/redirect/8'".to_string()
);
let calls = client
.execute_with_redirect(&request_spec, &options, &logger)
@ -546,7 +546,7 @@ fn test_multipart_form_data() {
};
assert_eq!(
client.curl_command_line(&request_spec, &context_dir, &options),
"curl -F 'key1=value1' -F 'upload1=@data.txt;type=text/plain' -F 'upload2=@data.html;type=text/html' -F 'upload3=@data.txt;type=text/html' 'http://localhost:8000/multipart-form-data'".to_string()
"curl --form 'key1=value1' --form 'upload1=@data.txt;type=text/plain' --form 'upload2=@data.html;type=text/html' --form 'upload3=@data.txt;type=text/html' 'http://localhost:8000/multipart-form-data'".to_string()
);
let (request, response) = client.execute(&request_spec, &options, &logger).unwrap();
@ -590,7 +590,7 @@ fn test_post_bytes() {
};
assert_eq!(
client.curl_command_line(&request_spec, &context_dir, &options),
"curl -H 'Content-Type: application/octet-stream' --data $'\\x48\\x65\\x6c\\x6c\\x6f\\x20\\x57\\x6f\\x72\\x6c\\x64\\x21' 'http://localhost:8000/post-base64'".to_string()
"curl --header 'Content-Type: application/octet-stream' --data $'\\x48\\x65\\x6c\\x6c\\x6f\\x20\\x57\\x6f\\x72\\x6c\\x64\\x21' 'http://localhost:8000/post-base64'".to_string()
);
let (request, response) = client.execute(&request_spec, &options, &logger).unwrap();
assert!(request.headers.contains(&Header {
@ -628,7 +628,7 @@ fn test_expect() {
};
assert_eq!(
client.curl_command_line(&request_spec, &context_dir, &options),
"curl -H 'Expect: 100-continue' -H 'Content-Type:' --data 'data' 'http://localhost:8000/expect'".to_string()
"curl --header 'Expect: 100-continue' --header 'Content-Type:' --data 'data' 'http://localhost:8000/expect'".to_string()
);
let (request, response) = client.execute(&request_spec, &options, &logger).unwrap();