curl: use long arguments (#5872)

This commit is contained in:
Nicolas Kosinski
2021-05-04 11:37:07 +02:00
committed by GitHub
parent d02172f9ef
commit 69f02b6510
7 changed files with 54 additions and 54 deletions

View File

@@ -6,31 +6,31 @@
- Download the contents of an URL to a file:
`curl {{http://example.com}} -o {{filename}}`
`curl {{http://example.com}} --output {{filename}}`
- Download a file, saving the output under the filename indicated by the URL:
`curl -O {{http://example.com/filename}}`
`curl --remote-name {{http://example.com/filename}}`
- Download a file, following [L]ocation redirects, and automatically [C]ontinuing (resuming) a previous file transfer:
- Download a file, following location redirects, and automatically continuing (resuming) a previous file transfer:
`curl -O -L -C - {{http://example.com/filename}}`
`curl --remote-name --location --continue-at - {{http://example.com/filename}}`
- Send form-encoded data (POST request of type `application/x-www-form-urlencoded`). Use `-d @file_name` or `-d @'-'` to read from STDIN:
- Send form-encoded data (POST request of type `application/x-www-form-urlencoded`). Use `--data @file_name` or `--data @'-'` to read from STDIN:
`curl -d {{'name=bob'}} {{http://example.com/form}}`
`curl --data {{'name=bob'}} {{http://example.com/form}}`
- Send a request with an extra header, using a custom HTTP method:
`curl -H {{'X-My-Header: 123'}} -X {{PUT}} {{http://example.com}}`
`curl --header {{'X-My-Header: 123'}} --request {{PUT}} {{http://example.com}}`
- Send data in JSON format, specifying the appropriate content-type header:
`curl -d {{'{"name":"bob"}'}} -H {{'Content-Type: application/json'}} {{http://example.com/users/1234}}`
`curl --data {{'{"name":"bob"}'}} --header {{'Content-Type: application/json'}} {{http://example.com/users/1234}}`
- Pass a user name and password for server authentication:
`curl -u myusername:mypassword {{http://example.com}}`
`curl --user myusername:mypassword {{http://example.com}}`
- Pass client certificate and key for a resource, skipping certificate validation: