summary refs log tree commit diff stats
path: root/http.go
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2019-05-21 22:32:49 -0400
committerBen Morrison <ben@gbmor.dev>2019-05-21 22:32:49 -0400
commit54a4f6f720979dc8c8d6224acd24f04d147ef761 (patch)
tree5c7d8c19d8ca0f145cee9234578e881366989b35 /http.go
parent360f7e248a065a766890db9b4f65757dc6365eb2 (diff)
downloadgetwtxt-54a4f6f720979dc8c8d6224acd24f04d147ef761.tar.gz
fixed http 400 response and test
Diffstat (limited to 'http.go')
-rw-r--r--http.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/http.go b/http.go
index 9b5dd81..b6c1cee 100644
--- a/http.go
+++ b/http.go
@@ -45,9 +45,10 @@ func log200(r *http.Request) {
 }
 
 // log output for 400s
-func log400(r *http.Request, err error) {
+func log400(w http.ResponseWriter, r *http.Request, err error) {
 	uip := getIPFromCtx(r.Context())
 	log.Printf("*** %v :: 400 :: %v %v :: %v\n", uip, r.Method, r.URL, err)
+	http.Error(w, "400 Bad Request: "+err.Error(), http.StatusBadRequest)
 }
 
 // log output for 404s