ensure a response is always sent

This commit is contained in:
Peter Rounce 2022-08-24 15:23:24 +00:00
parent 8c1150468d
commit 8d1d686355
4 changed files with 51 additions and 25 deletions

View file

@ -6,6 +6,13 @@ import (
"os"
)
func write_error(w http.ResponseWriter) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusOK)
jsonData := []byte(`{"status":"ERROR","reason":"bad request"}`)
w.Write(jsonData)
}
func main() {
log_level := os.Getenv("LOG_LEVEL")