 (defn get-request-format
   "Returns the requested format parsed from headers"
   [headers supported-types]
-  (let [mime-type (get headers "accept")]
+  (let [mime-type (mime-type-from-headers headers supported-types)]
     (validate-request-mime-type mime-type supported-types)
     (mime-type->format mime-type)))
(ns cmr.common.mime-types
  "Provides functions for handling mime types."
  (:require [pantomime.media :as mt]
            [cmr.common.services.errors :as errors]))

(def base-mime-type-to-format

         (get base-mime-type-to-format (base-mime-type default-mime-type)))
     (get base-mime-type-to-format (base-mime-type default-mime-type)))))

(defn mime-type-from-headers
  "Try to get a supported mime-type from the 'accept' header."
  [headers supported-mime-types]
  (let [mime-type-str (when-let [mstr (get headers "accept")]
                        ;; Strip out any semicolon clauses
                        (str/replace mstr #";.*?(,|$)" "$1"))
        ;; Split mime-type string on commas
        mime-types (when mime-type-str (str/split (str/lower-case mime-type-str), #"[,]"))
        first-supported-mime-type (some (set mime-types) supported-mime-types)]
    (or first-supported-mime-type mime-type-str)))

(defn validate-request-mime-type
  "Validates the requested mime type is supported."
  [mime-type supported-types]
