Skip to content

Http effect: no HTTP status code access #352

@aallan

Description

@aallan

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestlimitationKnown compilation limitation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions