Skip to content

Conversation

DerGuteMoritz
Copy link
Collaborator

@DerGuteMoritz DerGuteMoritz commented Sep 16, 2025

To that end, turn wrap-exceptions from a wrapping middleware into an "after handler" (like
handle-redirects) called handle-error-status.

This also happens to improve a suboptimal behavior: When a request with :throw-exceptions? true
was made and an error response was received which the middleware would turn into an exception, the
underlying connection would be closed regardless of whether the response indicated keep-alive or not.

Fixes #766 except for cases originating from Manifold's d/timeout! which needs to be fixed there.

@DerGuteMoritz DerGuteMoritz marked this pull request as draft September 16, 2025 15:39
@DerGuteMoritz DerGuteMoritz changed the title Draft: Make wrap-exceptions middleware robust against nil response body Don't leak unconsumed deferreds in error state in HTTP client Sep 18, 2025
To that end, turn `wrap-exceptions` from a wrapping middleware into an "after handler" (like
`handle-redirects`) called `handle-error-status`.

This also happens to improve a suboptimal behavior: When a request with `:throw-exceptions? true`
was made and an error response was received which the middleware would turn into an exception, the
underlying connection would be closed regardless of whether the response indicated keep-alive or not.

Fixes #766 except for cases originating from Manifold's `d/timeout!` which needs to be fixed there.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NPE in wrap-exceptions HTTP client middleware
1 participant