NewHTTPServer creates a new HTTP RPC server around an API provider. Deprecated: Server implements http.Handler
(cors []string, vhosts []string, srv *Server)
| 162 | // |
| 163 | // Deprecated: Server implements http.Handler |
| 164 | func NewHTTPServer(cors []string, vhosts []string, srv *Server) *http.Server { |
| 165 | // Wrap the CORS-handler within a host-handler |
| 166 | handler := newCorsHandler(srv, cors) |
| 167 | handler = newVHostHandler(vhosts, handler) |
| 168 | return &http.Server{ |
| 169 | Handler: handler, |
| 170 | ReadTimeout: 5 * time.Second, |
| 171 | WriteTimeout: 10 * time.Second, |
| 172 | IdleTimeout: 120 * time.Second, |
| 173 | } |
| 174 | } |
| 175 | |
| 176 | // ServeHTTP serves JSON-RPC requests over HTTP. |
| 177 | func (srv *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { |
no test coverage detected