The Http effect (#57) returns Result<String, String> — the Ok variant contains the response body, the Err variant contains an error message string (e.g. "HTTP 404: Not Found"). There is no structured access to HTTP status codes, response headers, or other metadata.
Impact
Programs that need to distinguish between different HTTP error codes (e.g. 401 vs 404 vs 500) must parse the error string, which is fragile.
Possible fix
Introduce an HttpResponse ADT:
data HttpResponse {
HttpResponse(Int, Map<String, String>, String) -- status, headers, body
}
And change return type to Result<HttpResponse, String>.
Related: #57 (Http effect), #351 (headers)
The
Httpeffect (#57) returnsResult<String, String>— the Ok variant contains the response body, the Err variant contains an error message string (e.g."HTTP 404: Not Found"). There is no structured access to HTTP status codes, response headers, or other metadata.Impact
Programs that need to distinguish between different HTTP error codes (e.g. 401 vs 404 vs 500) must parse the error string, which is fragile.
Possible fix
Introduce an
HttpResponseADT:And change return type to
Result<HttpResponse, String>.Related: #57 (Http effect), #351 (headers)