             [clojure.string :as string]
             [compojure.route :refer [not-found]]
             [ring.util.response :refer [response status header]]
+            [pantomime.mime :refer [mime-type-of]]
             [digest :as digest]
             [vignette.media-types :refer :all]
             [vignette.util.query-options :refer :all]

       (when-header-val "ETag" (str "\"" (etag image) "\""))
       (header "X-Thumbnailer" "Vignette")
       (add-content-disposition-header image-map image)
       (add-surrogate-header image-map)))
  ([image]
   (create-image-response image nil)))


      (digest/sha1 (fully-qualified-original-path image-map))
      (catch Exception e
        (str "vignette-" (:original image-map))))))

(def vary-accept-mime-types #{"image/jpeg" "image/png"})
(defn is-vary-required
  [file]
  (contains? vary-accept-mime-types (mime-type-of (or file ""))))

(defn add-vary-header
  [response-map image-map]
  (if (is-vary-required (original-path image-map))
  (-> response-map
      (header "Vary" "Accept"))
  response-map))

