code: func (s *Service) handleQuery(connID uint64, w http.ResponseWriter, r *http.Request) {
  	isAtomic, err := isAtomic(r)
  	if err != nil {
  		http.Error(w, err.Error(), http.StatusInternalServerError)
  		return
  	}
  
  	timings, err := timings(r)
  	if err != nil {
  		http.Error(w, err.Error(), http.StatusInternalServerError)
  		return
  	}
  
  	lvl, err := level(r)
  	if err != nil {
  		http.Error(w, err.Error(), http.StatusInternalServerError)
  		return
  	}
  
  	// Get the query statement(s), and do tx if necessary.
  	queries, err := requestQueries(r)
  	if err != nil {
  		w.WriteHeader(http.StatusBadRequest)
  		return
  	}
  
  	// Get the right queryer object.
  	var queryer Queryer
  	if connID == defaultConnID {
  		queryer = s.store
  	} else {
  		c, ok := s.store.Connection(connID)
  		if !ok {
  			http.Error(w, "connection not found", http.StatusNotFound)
  			return
  		}
  		queryer = c
  	}
  
  	var resp Response
  	results, err := queryer.Query(&store.QueryRequest{queries, timings, isAtomic, lvl})
  	if err != nil {
  		if err == store.ErrNotLeader {
  			leader := s.leaderAPIAddr()
  			if leader == "" {
  				http.Error(w, err.Error(), http.StatusServiceUnavailable)
  				return
  			}
  
  			redirect := s.FormRedirect(r, leader)
  			http.Redirect(w, r, redirect, http.StatusMovedPermanently)
  			return
  		}
  		resp.Error = err.Error()
  	} else {
  		resp.Results = results.Rows
  		if timings {
  			resp.Time = results.Time
  		}
  		resp.Raft = results.Raft
  	}
  	writeResponse(w, r, &resp)
  }
docs: // handleQuery handles queries that do not modify the database.