Fork me on GitHub
#funcool
<
2016-10-28
>
kenny21:10:55

@niwinz Best way to attach the parsed :body with body-params and the :body as a string on the context?

kenny22:10:03

I came up with

(defn body->string
  [ctx]
  (ct/delegate
    {:body-str
     (when-let [body ^TypedData (:body ctx)]
       (-> body .getBytes String.))}))
It's not my favorite solution because it also requires you to include catacumba.handlers.parse/read-body before the body->string handler. Would it make sense to add the option to include the body string to catacumba.handlers.parse/body-params?