From 7e1f90f27d876db67158ca4787420ec30c18f86b Mon Sep 17 00:00:00 2001 From: clsr Date: Fri, 1 Sep 2017 16:11:42 +0200 Subject: Distinguish between response length=0 and no length parameter Response.Length returns -1 when the parameter is not present and 0 when it's set to 0. Response.SetLength will only unset the parameter when given -1. --- server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'server.go') diff --git a/server.go b/server.go index 26301ab..c8491fc 100644 --- a/server.go +++ b/server.go @@ -139,7 +139,7 @@ func (srv *Server) HandleConn(conn net.Conn) { req.Body = io.LimitReader(req.Body, req.Length()) if srv.Validate { - if err != nil { + if err := req.Validate(); err != nil { panic(err) } } -- cgit