From ce3182d4c3f5fb723a16bece3157a5058b1236f9 Mon Sep 17 00:00:00 2001 From: Grégoire Duchêne Date: Sun, 14 Mar 2021 15:41:22 +0000 Subject: Move Twilio authn code into its own package --- pkg/twilio/util.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 pkg/twilio/util.go (limited to 'pkg/twilio/util.go') 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 +// 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, "") +}) -- cgit v1.2.3-70-g09d2