Just started using huff. Problem: my Ring stack blew up because of the RawString instance returned by huff2.core/html.
I added this middleware:
(defn expand-raw-string-body
[f]
(fn [request]
(let [response (f request)]
(if (-> response :body huff/raw-string?)
(update response :body str)
response))))
This should be documented.
This might be an issue with http-kit rather than Ring itself:
java.lang.RuntimeException: class huff2.core.RawString is not understandable
at org.httpkit.HttpUtils.bodyBuffer(HttpUtils.java:125)
at org.httpkit.HttpUtils.HttpEncode(HttpUtils.java:451)
at org.httpkit.server.HttpHandler.handleResponse(RingHandler.java:188)
at org.httpkit.server.HttpHandler.runSync(RingHandler.java:144)
at org.httpkit.server.HttpHandler.run(RingHandler.java:138)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:545)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:328)
at java.base/java.lang.VirtualThread.run(VirtualThread.java:466)