diff options
author | Ben Morrison <ben@gbmor.dev> | 2019-05-21 22:32:49 -0400 |
---|---|---|
committer | Ben Morrison <ben@gbmor.dev> | 2019-05-21 22:32:49 -0400 |
commit | 54a4f6f720979dc8c8d6224acd24f04d147ef761 (patch) | |
tree | 5c7d8c19d8ca0f145cee9234578e881366989b35 /http.go | |
parent | 360f7e248a065a766890db9b4f65757dc6365eb2 (diff) | |
download | getwtxt-54a4f6f720979dc8c8d6224acd24f04d147ef761.tar.gz |
fixed http 400 response and test
Diffstat (limited to 'http.go')
-rw-r--r-- | http.go | 3 |
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 |