code: func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
  	// Permit dumb empty requests for remote health-checks (AWS)
  	if r.Method == http.MethodGet && r.ContentLength == 0 && r.URL.RawQuery == "" {
  		return
  	}
  	if code, err := validateRequest(r); err != nil {
  		http.Error(w, err.Error(), code)
  		return
  	}
  	// All checks passed, create a codec that reads direct from the request body
  	// untilEOF and writes the response to w and order the server to process a
  	// single request.
  	ctx := r.Context()
  	ctx = context.WithValue(ctx, "remote", r.RemoteAddr)
  	ctx = context.WithValue(ctx, "scheme", r.Proto)
  	ctx = context.WithValue(ctx, "local", r.Host)
  	if ua := r.Header.Get("User-Agent"); ua != "" {
  		ctx = context.WithValue(ctx, "User-Agent", ua)
  	}
  	if origin := r.Header.Get("Origin"); origin != "" {
  		ctx = context.WithValue(ctx, "Origin", origin)
  	}
  
  	w.Header().Set("content-type", contentType)
  	codec := newHTTPServerConn(r, w)
  	defer codec.Close()
  	s.serveSingleRequest(ctx, codec)
  }
docs: // ServeHTTP serves JSON-RPC requests over HTTP.