Fork me on GitHub
#reitit
<
2021-12-03
>
Kira McLean16:12:29

Hi folks. I’m wondering if anyone has successfully used muuntaja with a custom format? I want to it to treat `application/geo+json` the same as `application/json` but am having a hard time. have tried so far making a custom muuntaja instance in 2 different ways: with a custom format for geo+json that uses the same encoder/decoder as json

(m/create
    (assoc-in m/default-options
              [:formats "application/geo+json"]
              geo+json-format))
 and adding a matches regex for json to try to make it treat geo+json the same:
(m/create
    (assoc-in m/default-options
              [:formats "application/json" :matches]
              #"^application\/(geo\+)?json$"))
and using that custom instance in the ring/router setup, like
(ring/router data {:data {:muuntaja content-negotiator
                            :middleware [...]}})
right now it looks like it’s just not recognizing `application/geo+json` as a response content type.. I get a 500 error, basically “can’t write map to streamable response body”, similar to what I get if I disable content negotiation entirely