aboutsummaryrefslogtreecommitdiff
path: root/pkg/twilio/util.go
diff options
context:
space:
mode:
authorGrégoire Duchêne <gduchene@awhk.org>2021-03-14 15:41:22 +0000
committerGrégoire Duchêne <gduchene@awhk.org>2021-03-14 15:41:22 +0000
commitce3182d4c3f5fb723a16bece3157a5058b1236f9 (patch)
tree858301133dd6a547e935da356f049ac165261c06 /pkg/twilio/util.go
parentd10731043bfd7429ebd22c717794c8363f462caf (diff)
Move Twilio authn code into its own package
Diffstat (limited to 'pkg/twilio/util.go')
-rw-r--r--pkg/twilio/util.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/pkg/twilio/util.go b/pkg/twilio/util.go
new file mode 100644
index 0000000..1f1d269
--- /dev/null
+++ b/pkg/twilio/util.go
@@ -0,0 +1,16 @@
+// SPDX-FileCopyrightText: © 2021 Grégoire Duchêne <gduchene@awhk.org>
+// SPDX-License-Identifier: ISC
+
+package twilio
+
+import (
+ "fmt"
+ "net/http"
+)
+
+// EmptyResponseHandler writes an empty XML response so Twilio knows not
+// to do anything after a webhook has been called.
+var EmptyResponseHandler = http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
+ w.Header().Set("Content-Type", "text/xml")
+ fmt.Fprint(w, "<Response/>")
+})