-
Notifications
You must be signed in to change notification settings - Fork 915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make RpcResponse
provide the resopnse payload directly
#3185
Conversation
|
11c2b74
to
cf99f67
Compare
216d952
to
75ad8c6
Compare
cf99f67
to
de2bb81
Compare
75ad8c6
to
f3051ba
Compare
de2bb81
to
e8fc7ad
Compare
f3051ba
to
38241cb
Compare
e8fc7ad
to
efdef44
Compare
54addbf
to
e36ee23
Compare
efdef44
to
50e9859
Compare
e36ee23
to
bf4897c
Compare
50e9859
to
191c075
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function createMockResponse<T>(jsonResponse: T): RpcResponse<T> { | ||
return { | ||
json: () => Promise.resolve(jsonResponse), | ||
text: () => Promise.resolve(JSON.stringify(jsonResponse)), | ||
}; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this was the clue, all along.
Merge activity
|
191c075
to
4f05c0d
Compare
Because there has been no activity on this PR for 14 days since it was merged, it has been automatically locked. Please open a new issue if it requires a follow up. |
This PR reverts some of the changes in the previous stack by making the following key change:
This is because we no longer believe that it is the responsibility of the RPC API to affect the response as text or JSON. This aspect should be encapsulated by the RPC Transport layer, meaning any custom JSON parsing/stringifying will need to be done at the RPC Transport layer.
Note that, we could simply delete the
RpcResponse
type since it returns its type parameter directly but keeping it makes the code clearer as we will useRpcResponse
instead ofunknown
everywhere in the codebase.