aboutsummaryrefslogtreecommitdiff
path: root/pkg/twilio/util.go
diff options
context:
space:
mode:
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/>")
+})