Skip to content
This repository has been archived by the owner on Nov 9, 2023. It is now read-only.

Add pending response type #75

Merged
merged 2 commits into from
Nov 20, 2020
Merged

Add pending response type #75

merged 2 commits into from
Nov 20, 2020

Conversation

rekmarks
Copy link
Member

@rekmarks rekmarks commented Nov 20, 2020

Using the JsonRpcResponse type in middleware became really painful when implementing middleware. When a response object is in a middleware, it's not a finished response; it's pending. If you use JsonRpcResponse, you have to re-cast the response object in order to set either error or result. That sucks.

To fix this sorry state of affairs, this PR replaces the InternalJsonRpcResponse interface with an exported, genericized PendingJsonRpcResponse interface. This could be abused in terms of type safety by setting both result and error on a response, but result will be deleted if error is present.

@rekmarks rekmarks requested a review from a team as a code owner November 20, 2020 07:03
@rekmarks rekmarks merged commit 20e58bc into main Nov 20, 2020
@rekmarks rekmarks deleted the pending-response-type branch November 20, 2020 16:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants