gnarroway / hato

An HTTP client for Clojure, wrapping JDK 11's HttpClient
MIT License
380 stars 27 forks source link

Don't swallow exceptions in parsing transit+json #47

Closed tggreene closed 2 years ago

tggreene commented 2 years ago

This PR prevents cases where having :as :transit+json with a non json body will silently swallow an exception and return nil. Also prevents situations where the server advertises the content-type of application/transit+json but returns an unparsable body which would also previously be silently ignored by the automatic decoding.

I've not created a corresponding issue, although happy to if it's helpful.

This PR also doesn't attempt to solve anything similar for the msgpack case where any bytes in the body can be interpreted as a sequence of values (i.e. it typically doesn't fail regardless of body contents and returns some value).

gnarroway commented 2 years ago

thanks!