From 03f02e7dfca1392dbf814ff300883d7063994874 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Fri, 8 Jul 2022 14:50:00 -0600 Subject: [PATCH] docs: Remove -X POST Curl automatically uses POST for -d and --data-binary. I intentionally left it in to be explicit to learners, but maybe best practices are better. --- src/docs/markdown/api-tutorial.md | 5 ----- src/docs/markdown/api.md | 8 ++++---- src/docs/markdown/config-adapters.md | 1 - src/docs/markdown/getting-started.md | 1 - src/docs/markdown/quick-starts/api.md | 2 -- src/docs/markdown/quick-starts/caddyfile.md | 1 - 6 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/docs/markdown/api-tutorial.md b/src/docs/markdown/api-tutorial.md index ad93d45..a47fac4 100644 --- a/src/docs/markdown/api-tutorial.md +++ b/src/docs/markdown/api-tutorial.md @@ -68,7 +68,6 @@ Save this to a JSON file: Then upload it:
curl localhost:2019/load \
-	-X POST \
 	-H "Content-Type: application/json" \
 	-d @caddy.json
 
@@ -104,7 +103,6 @@ Let's change our welcome message from "Hello world!" to something a little more Save the config file, then update Caddy's active configuration by running the same POST request again:
curl localhost:2019/load \
-	-X POST \
 	-H "Content-Type: application/json" \
 	-d @caddy.json
 
@@ -130,7 +128,6 @@ Using the request URI's path, we can traverse into the config structure and upda
curl \
 	localhost:2019/config/apps/http/servers/example/routes/0/handle/0/body \
-	-X POST \
 	-H "Content-Type: application/json" \
 	-d '"Work smarter, not harder."'
 
@@ -171,7 +168,6 @@ We can give our handler object an [`@id` tag](/docs/api#using-id-in-json) to mak
curl \
 	localhost:2019/config/apps/http/servers/example/routes/0/handle/0/@id \
-	-X POST \
 	-H "Content-Type: application/json" \
 	-d '"msg"'
 
@@ -198,7 +194,6 @@ And now we can change the message with a shorter path:
curl \
 	localhost:2019/id/msg/body \
-	-X POST \
 	-H "Content-Type: application/json" \
 	-d '"Some shortcuts are good."'
 
diff --git a/src/docs/markdown/api.md b/src/docs/markdown/api.md index 0d404b7..2c55e2f 100644 --- a/src/docs/markdown/api.md +++ b/src/docs/markdown/api.md @@ -64,13 +64,13 @@ If the new config is the same as the current one, no reload will occur. To force Set a new active configuration: -
curl -X POST "http://localhost:2019/load" \
+
curl "http://localhost:2019/load" \
 	-H "Content-Type: application/json" \
 	-d @caddy.json
Note: curl's `-d` flag removes newlines, so if your config format is sensitive to line breaks (e.g. the Caddyfile), use `--data-binary` instead: -
curl -X POST "http://localhost:2019/load" \
+
curl "http://localhost:2019/load" \
 	-H "Content-Type: text/caddyfile" \
 	--data-binary @Caddyfile
@@ -152,14 +152,14 @@ baseSlice = append(baseSlice, newElems...) Add a listener address: -
curl -X POST \
+
curl \
 	-H "Content-Type: application/json" \
 	-d '":8080"' \
 	"http://localhost:2019/config/apps/http/servers/myserver/listen"
Add multiple listener addresses: -
curl -X POST \
+
curl \
 	-H "Content-Type: application/json" \
 	-d '[":8080", ":5133"]' \
 	"http://localhost:2019/config/apps/http/servers/myserver/listen/..."
diff --git a/src/docs/markdown/config-adapters.md b/src/docs/markdown/config-adapters.md index 8f189ae..504ec56 100644 --- a/src/docs/markdown/config-adapters.md +++ b/src/docs/markdown/config-adapters.md @@ -32,7 +32,6 @@ You can use a config adapter by specifying it on the command line by using the ` Or via the API at the [`/load` endpoint](/docs/api#post-load):
curl localhost:2019/load \
-	-X POST \
 	-H "Content-Type: application/yaml" \
 	--data-binary @caddy.yaml
diff --git a/src/docs/markdown/getting-started.md b/src/docs/markdown/getting-started.md index d34ce2b..1ee4ca8 100644 --- a/src/docs/markdown/getting-started.md +++ b/src/docs/markdown/getting-started.md @@ -89,7 +89,6 @@ Save this to a JSON file (e.g. `caddy.json`): Then upload it:
curl localhost:2019/load \
-	-X POST \
 	-H "Content-Type: application/json" \
 	-d @caddy.json
 
diff --git a/src/docs/markdown/quick-starts/api.md b/src/docs/markdown/quick-starts/api.md index c4000ec..5e394c1 100644 --- a/src/docs/markdown/quick-starts/api.md +++ b/src/docs/markdown/quick-starts/api.md @@ -17,7 +17,6 @@ First start Caddy: Caddy is currently running idle (with a blank configuration). Give it a simple config with `curl`:
curl localhost:2019/load \
-    -X POST \
     -H "Content-Type: application/json" \
     -d @- << EOF
     {
@@ -44,7 +43,6 @@ EOF
Giving a POST body with [Heredoc](https://en.wikipedia.org/wiki/Here_document#Unix_shells) can be tedious, so if you prefer to use files, save the JSON to a file called `caddy.json` and then use this command instead:
curl localhost:2019/load \
-  -X POST \
   -H "Content-Type: application/json" \
   -d @caddy.json
 
diff --git a/src/docs/markdown/quick-starts/caddyfile.md b/src/docs/markdown/quick-starts/caddyfile.md index 30539f7..6d995d7 100644 --- a/src/docs/markdown/quick-starts/caddyfile.md +++ b/src/docs/markdown/quick-starts/caddyfile.md @@ -56,7 +56,6 @@ localhost:2016 { You can give Caddy the updated configuration two ways, either with the API directly:
curl localhost:2019/load \
-	-X POST \
 	-H "Content-Type: text/caddyfile" \
 	--data-binary @Caddyfile