    [ring.util.codec :as codec]
    [ring.swagger.schema :as rs]
    [yada.charset :as charset]
+   [yada.journal :as journal]
    [yada.media-type :as mt])
   (:import
    [clojure.core.async.impl.channels ManyToManyChannel]

(defmulti render-map (fn [resource representation] (-> representation :media-type mt/media-type)))
(defmulti render-seq (fn [resource representation] (-> representation :media-type mt/media-type)))

(extend-protocol MessageBody

  String
  ;; A String is already its own representation, all we must do now is encode it to a char buffer
  (to-body [s representation]
    (bs/convert s java.nio.ByteBuffer
                {:encoding (or (some-> representation :charset charset/charset)
                               charset/default-platform-charset)}))

  ;; The content-length is NOT the length of the string, but the
  ;; "decimal number of octets, for a potential payload body".

  (:require
   [clojure.walk :refer [keywordize-keys]]
   [clojure.pprint :refer [pprint]]
   [clojure.tools.logging :refer :all]
   [byte-streams :as bs]
   [cheshire.core :as json]
   [hiccup.core :refer [html]]
