Redesign ResponseWriter interface

This commit is contained in:
Adnan Maolood
2021-02-17 13:36:16 -05:00
parent 8543eca416
commit 110c2de6de
4 changed files with 60 additions and 64 deletions

View File

@@ -380,7 +380,7 @@ func (srv *Server) respond(conn net.Conn) {
req, err := ReadRequest(conn)
if err != nil {
w.Status(StatusBadRequest)
w.WriteHeader(StatusBadRequest, "Bad request")
w.Flush()
return
}
@@ -396,7 +396,7 @@ func (srv *Server) respond(conn net.Conn) {
h := srv.handler(req)
if h == nil {
w.Status(StatusNotFound)
w.WriteHeader(StatusNotFound, "Not found")
w.Flush()
return
}