   [context]
   (let [^TypedData body (:body context)
         ^String content-type (.. body getContentType getType)]
-    (when content-type
-      (keyword (.toLowerCase content-type)))))
+    (if content-type
+      (keyword (.toLowerCase content-type))
+      :application/transit+json)))
+
+(defn- get-incoming-data
+  [context]
+  (if (= (:method context) :get)
+    (if-let [data (get-in context [:query-params :d] nil)]
+      (codecs/safebase64->bytes data)
+      (byte-array 0))
+    (.getBytes ^TypedData (:body context))))
 
 (defn- normalize-frame
   [frame]

       (let [content-type (get-content-type context)
             context (assoc context ::content-type content-type)
             data (get-incoming-data context)
             frame (decode data content-type)]
         (dispatch handler context content-type frame))
       (catch Exception e
         (http/unsupported-mediatype (str e)))))))

(defn stream
  [context handler]
  (let [content-type (::content-type context)]
    (letfn [(encode-message [msg]
              (-> (normalize-frame msg)
                  (encode content-type)
                  (codecs/bytes->str)))
            (inner-handler [context out]
              (let [xf (map encode-message)
                    out' (a/chan 1 xf)]
                (a/pipe out' out true)
                (handler context out')))]
      (implsse/sse context inner-handler))))

  (:require [clojure.core.async :as a]
            [catacumba.serializers :as sz]
            [catacumba.http :as http]
            [catacumba.helpers :as hp]
            [catacumba.impl.websocket :as implws]
            [buddy.core.codecs :as codecs]
            [manifold.deferred :as md]
            [promissum.core :as p])
