code: func (h *Handler) handlePostQuery(w http.ResponseWriter, r *http.Request) {
  	// Parse incoming request.
  	req, err := h.readQueryRequest(r)
  	if err != nil {
  		w.WriteHeader(http.StatusBadRequest)
  		e := h.writeQueryResponse(w, r, &pilosa.QueryResponse{Err: err})
  		if e != nil {
  			h.logger.Printf("write query response error: %v (while trying to write another error: %v)", e, err)
  		}
  		return
  	}
  	// TODO: Remove
  	req.Index = mux.Vars(r)["index"]
  
  	resp, err := h.api.Query(r.Context(), req)
  	if err != nil {
  		switch errors.Cause(resp.Err) {
  		case pilosa.ErrTooManyWrites:
  			w.WriteHeader(http.StatusRequestEntityTooLarge)
  		default:
  			w.WriteHeader(http.StatusBadRequest)
  		}
  		e := h.writeQueryResponse(w, r, &pilosa.QueryResponse{Err: err})
  		if e != nil {
  			h.logger.Printf("write query response error: %v (while trying to write another error: %v)", e, err)
  		}
  		return
  	}
  
  	// Set appropriate status code, if there is an error. It doesn't appear that
  	// resp.Err could ever be set in API.Query, so this code block is probably
  	// doing nothing right now.
  	if resp.Err != nil {
  		switch errors.Cause(resp.Err) {
  		case pilosa.ErrTooManyWrites:
  			w.WriteHeader(http.StatusRequestEntityTooLarge)
  		default:
  			w.WriteHeader(http.StatusBadRequest)
  		}
  	}
  
  	// Write response back to client.
  	if err := h.writeQueryResponse(w, r, &resp); err != nil {
  		h.logger.Printf("write query response error: %s", err)
  	}
  }
docs: // handlePostQuery handles /query requests.