You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, Codec#json(), used by TapirJsonCirce, will interpret an output type of Option[*] as designating an optional body: If the value is None, the response will override the underlying JSON codec's rendering to null and produce an empty body instead, which is no legal JSON, but still declare a content type of application/json.
This could either be helped by omitting the Content-type header upon empty body (and perhaps forcing a 204 status code?), or by removing the in-band signaling, i.e. encoding Option values according to the underlying codec and handling the optional body case elsewhere.
Currently,
Codec#json()
, used byTapirJsonCirce
, will interpret an output type ofOption[*]
as designating an optional body: If the value isNone
, the response will override the underlying JSON codec's rendering tonull
and produce an empty body instead, which is no legal JSON, but still declare a content type ofapplication/json
.This could either be helped by omitting the
Content-type
header upon empty body (and perhaps forcing a 204 status code?), or by removing the in-band signaling, i.e. encodingOption
values according to the underlying codec and handling the optional body case elsewhere.Discussion: https://softwaremill.community/t/why-map-none-to-empty-string-in-json-codec/381
The text was updated successfully, but these errors were encountered: