Skip to content

Instantly share code, notes, and snippets.

@mccraigmccraig
Created May 23, 2017 17:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mccraigmccraig/65748e21995b37549ccc72fe6e1daca9 to your computer and use it in GitHub Desktop.
Save mccraigmccraig/65748e21995b37549ccc72fe6e1daca9 to your computer and use it in GitHub Desktop.
(ns er-model.util.mime
(:require
[clojure.string :as str]))
(defn parse-content-type
[ct]
(let [[content-type & params] (str/split ct #"\s*;\s*")
param-name-vals (for [p params]
(let [[n v] (str/split p #"\s*=\s*")]
[(keyword n) v]))
params (into {} param-name-vals)]
[content-type params]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment