Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
fix: add
accept: application/json
header to remote signer requests and improve invalid response handling #6587fix: add
accept: application/json
header to remote signer requests and improve invalid response handling #6587Changes from 20 commits
e062c15
5f54826
b02f666
657caab
ecdcc6a
383b07b
23ca7ba
8ce75ab
22f7131
6791ae3
f36052c
6742089
282cc86
94580d5
2b8e722
2696ea8
12b7bd9
4364c8b
bec5c5b
c3f1aa3
3100d07
127909d
facf88c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
No idea why neither Web3Signer nor Diva return proper errors as json but I made this a bit more future proof to handle potential json errors.
The spec does not define an error schema so we can't be sure how remote signers implement this.
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 don't think it's a good idea to treat error response as json if it's not in the spec. Even if the error response is actually json, you are not guaranteed that there is a field named
message
(it could bemsg
,error
or evenerrorMsg
...) and the result will be worse than if you had included the response content as plain text. You may also need to check thecontent-type
of the error response before treating it as json. I know there is a try/catch block, but why do this if it's not in the spec?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.
Ok fair, we would have to check content type and response format is unclear. Just assumed sane format similar to beacon api. Although for errors is not as critical to check proper format and have fallback logic via try/catch.
Let's keep error handling as is, the Diva team is working on the spec will ask them about it and see if we can standardize this a bit better.