 (defn- find-concept-by-cmr-concept-id
   "Invokes query service to find concept metadata by cmr concept id and returns the response"
   [context path-w-extension params headers]
-  (let [context (assoc context :token (get-token params headers))
+  (let [context (process-context-info context params headers)
         result-format (get-search-results-format path-w-extension headers
                                                  supported-concept-id-retrieval-mime-types
                                                  "application/echo10+xml")

      (dissoc :token)
      (assoc :result-format (get-search-results-format path-w-extension headers default-mime-type))))

(defn- find-concepts
  "Invokes query service to find results and returns the response"
  [context path-w-extension params headers query-string]
  (let [concept-type (concept-type-path-w-extension->concept-type path-w-extension)
        context (-> context
                    (assoc :query-string query-string)
                    (assoc :token (get-token params headers)))
        params (process-params params path-w-extension headers "application/xml")
        _ (info (format "Searching for %ss in format %s with params %s."
                        (name concept-type) (:result-format params) (pr-str params)))
        search-params (lp/process-legacy-psa params query-string)
        results (query-svc/find-concepts-by-parameters context concept-type search-params)]
    {:status 200

     ;; set the default format to xml
     (mt/mime-type->format mime-type :xml))))


(defn process-params
  "Processes the parameters by removing unecessary keys and adding other keys like result format."
