Suggestion for Improved Client JSON Handling
@Tim Smart when using HttpClient json, you no longer have anything from ClientResponse in A as it is replaced by parsed json and the type rightfully becomes unknown. Wouldn’t it make more sense to have a ClientResponseWithBody<unknown> or so, so we keep access to status code, headers etc too. And more importantly don’t have the somewhat unsafe “unknown” as the A type? Maybe body parsers like schema can also return ClientResponseWithBody<A>.
You can then still just map to take just the body to get old behavior
I was bitten by accidentally mapping errors in catchTag, instead of flat mapping them. So basically my A was unknown | SomeError. I was non the wiser until runtime however because that simplifies just to unknown.
You can then still just map to take just the body to get old behavior
I was bitten by accidentally mapping errors in catchTag, instead of flat mapping them. So basically my A was unknown | SomeError. I was non the wiser until runtime however because that simplifies just to unknown.
