1 package manager 2 3 import ( 4 "net/http" 5 "time" 6 ) 7 8 // TODO: look into possibly converting to gin 9 10 // NewServer returns a new server with sane defaults. 11 func NewServer(handler http.Handler) *http.Server { 12 return &http.Server{ 13 Handler: handler, 14 MaxHeaderBytes: 1 << 20, 15 IdleTimeout: 90 * time.Second, // matches http.DefaultTransport keep-alive timeout 16 ReadHeaderTimeout: 32 * time.Second, 17 } 18 } 19