diff --git a/.example/net/ghttp/server/static/static.go b/.example/net/ghttp/server/static/static.go index 5512aa705..3fbc63809 100644 --- a/.example/net/ghttp/server/static/static.go +++ b/.example/net/ghttp/server/static/static.go @@ -7,7 +7,9 @@ func main() { s := g.Server() s.SetIndexFolder(true) s.SetServerRoot("/Users/john/Downloads") - s.AddSearchPath("/Users/john/Documents") + //s.AddSearchPath("/Users/john/Documents") + s.SetErrorLogEnabled(true) + s.SetAccessLogEnabled(true) s.SetPort(8199) s.Run() } diff --git a/net/ghttp/ghttp_server_handler.go b/net/ghttp/ghttp_server_handler.go index 587456f6a..998aad231 100644 --- a/net/ghttp/ghttp_server_handler.go +++ b/net/ghttp/ghttp_server_handler.go @@ -140,7 +140,7 @@ func (s *Server) handleRequest(w http.ResponseWriter, r *http.Request) { // HTTP status checking. if request.Response.Status == 0 { - if request.Middleware.served || request.Response.buffer.Len() > 0 { + if serveFile != nil || request.Middleware.served || request.Response.buffer.Len() > 0 { request.Response.WriteHeader(http.StatusOK) } else { request.Response.WriteHeader(http.StatusNotFound)