From 34807dc5aac59570c59c96ab63e72ebaf068367b Mon Sep 17 00:00:00 2001
From: "Berk D. Demir"
Date: Sat, 18 Apr 2020 15:05:17 -0700
Subject: [PATCH] Remove redundant '-X POST' to curl
Passing `--data-raw` to curl implies the request is method will be POST.
Unless we intend to do something entirely different, -X method override
shouldn't be used.
Curl's author Daniel Stenberg (@bagder) wrote about this back in 2015
https://daniel.haxx.se/blog/2015/09/11/unnecessary-use-of-curl-x/
---
templates/docs/attaching_logs.html | 8 ++++----
templates/docs/attaching_logs.md | 8 ++++----
templates/docs/bash.html | 4 ++--
templates/docs/bash.md | 4 ++--
4 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/templates/docs/attaching_logs.html b/templates/docs/attaching_logs.html
index de84e44a..c7846a0d 100644
--- a/templates/docs/attaching_logs.html
+++ b/templates/docs/attaching_logs.html
@@ -9,7 +9,7 @@ the captured output to SITE_NAME:
#!/bin/sh
m=$(/usr/bin/certbot renew 2>&1)
-curl -fsS --retry 3 -X POST --data-raw "$m" PING_URL
+curl -fsS --retry 3 --data-raw "$m" PING_URL
@@ -23,12 +23,12 @@ depending on the exit code:
m=$(/usr/bin/certbot renew 2>&1)
if [ $? -ne 0 ]; then url=$url/fail; fi
-curl -fsS --retry 3 -X POST --data-raw "$m" $url
+curl -fsS --retry 3 --data-raw "$m" $url
All in One Line
Finally, all of the above can be packaged in a single line. The one-line
version can be put directly in crontab, without using a wrapper script.
-m=$(/usr/bin/certbot renew 2>&1); curl -fsS -X POST --data-raw "$m" "PING_URL$([ $? -ne 0 ] && echo -n /fail)"
-
\ No newline at end of file
+m=$(/usr/bin/certbot renew 2>&1); curl -fsS --data-raw "$m" "PING_URL$([ $? -ne 0 ] && echo -n /fail)"
+
diff --git a/templates/docs/attaching_logs.md b/templates/docs/attaching_logs.md
index dd134eae..d006a4ae 100644
--- a/templates/docs/attaching_logs.md
+++ b/templates/docs/attaching_logs.md
@@ -15,7 +15,7 @@ the captured output to SITE_NAME:
#!/bin/sh
m=$(/usr/bin/certbot renew 2>&1)
-curl -fsS --retry 3 -X POST --data-raw "$m" PING_URL
+curl -fsS --retry 3 --data-raw "$m" PING_URL
```
## In Combination with the `/fail` Endpoint
@@ -31,7 +31,7 @@ url=PING_URL
m=$(/usr/bin/certbot renew 2>&1)
if [ $? -ne 0 ]; then url=$url/fail; fi
-curl -fsS --retry 3 -X POST --data-raw "$m" $url
+curl -fsS --retry 3 --data-raw "$m" $url
```
## All in One Line
@@ -40,5 +40,5 @@ Finally, all of the above can be packaged in a single line. The one-line
version can be put directly in crontab, without using a wrapper script.
```bash
-m=$(/usr/bin/certbot renew 2>&1); curl -fsS -X POST --data-raw "$m" "PING_URL$([ $? -ne 0 ] && echo -n /fail)"
-```
\ No newline at end of file
+m=$(/usr/bin/certbot renew 2>&1); curl -fsS --data-raw "$m" "PING_URL$([ $? -ne 0 ] && echo -n /fail)"
+```
diff --git a/templates/docs/bash.html b/templates/docs/bash.html
index e06607e2..a1e030ad 100644
--- a/templates/docs/bash.html
+++ b/templates/docs/bash.html
@@ -40,7 +40,7 @@ will accept and store first 10KB of the request body.
#!/bin/sh
m=$(/usr/bin/certbot renew 2>&1)
-curl -fsS --retry 3 -X POST --data-raw "$m" PING_URL
+curl -fsS --retry 3 --data-raw "$m" PING_URL
@@ -62,4 +62,4 @@ register with SITE_NAME the first time they run.
# Finally, send a ping:
curl --retry 3 $URL
-
\ No newline at end of file
+
diff --git a/templates/docs/bash.md b/templates/docs/bash.md
index d8ae2be8..40455960 100644
--- a/templates/docs/bash.md
+++ b/templates/docs/bash.md
@@ -47,7 +47,7 @@ In the below example, certbot's output is captured and submitted via HTTP POST:
#!/bin/sh
m=$(/usr/bin/certbot renew 2>&1)
-curl -fsS --retry 3 -X POST --data-raw "$m" PING_URL
+curl -fsS --retry 3 --data-raw "$m" PING_URL
```
## Auto-provisioning New Checks
@@ -72,4 +72,4 @@ URL=`curl -s SITE_ROOT/api/v1/checks/ -H "X-Api-Key: $API_KEY" -d "$PAYLOAD" |
# Finally, send a ping:
curl --retry 3 $URL
-```
\ No newline at end of file
+```