Fork me on GitHub

I’m using a body-params interceptor to populate the request’s :json-params. ✓ (I’m a noob) What if I want to get at the request’s :body as a String? I see the :body isa HttpInputOverHTTP: But I don’t know out to get a String or a Reader out of that thing. Rather than digging directly into the Java stuff, I wondered if there was some interceptor or helper type fn to do that… (I realize that in general, I may be dealing with a MIME multi-part request and oy I just don’t want that complication, but I do, nevertheless need the content of the first part, as a String)


I’ve seen the “echo” handler but it punts on the issue:


hmm HttpInputOverHTTP isa InputStream


I have a route that looks like this:

["/subscribe" :get [(http-sse/start-event-stream stream-ready)] :route-name :subscribe]
where stream-ready is defined like this:
(require '[clojure.core.async :as async])
(require '[io.pedestal.http.sse :as sse])

(defn stream-ready
  [event-chan ctx]
  (async/go-loop []
    (async/<! (async/timeout 1000))
    (sse/send-event event-chan "example" "test")
In the browser I created an EventSource object and set the onmessage handler to just print out the event result. I get a new event message once per second. The event data looks something like this "[[email protected]", however. That looks a whole lot like how Clojure prints out Byte arrays. I'm wondering if Pedestal is incorrectly serializing SSE messages. These are the Pedestal dependencies that I have:
[io.pedestal/pedestal.service "0.5.3"]
[io.pedestal/pedestal.route "0.5.3"]
[io.pedestal/pedestal.jetty "0.5.3"]