change get api deal with the 500 code #10
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.
If you cat a wrong hash, the ipfs http api will response code 500
and with message. In this case if we use the response boy and cover it
to stream or byte ,it will not the true content of the hash code,it will
be the content of the 'Wrong Message'.
So we need check the response code by {response.isSuccessful} to insure
we go the right response.
OKHTTP: <-- 500 Internal Server Error http://127.0.0.1:5001/api/v0/cat/QmZC6gALejeRt2TAHHMnEkcEXeyX3XUSZ4yRkpt43UkM5A?timeout=30s (30002ms)
OKHTTP: Access-Control-Allow-Headers: X-Stream-Output, X-Chunked-Output, X-Content-Length
OKHTTP: Access-Control-Expose-Headers: X-Stream-Output, X-Chunked-Output, X-Content-Length
OKHTTP: Content-Type: application/json
OKHTTP: Server: go-ipfs/0.4.18-190117
OKHTTP: Trailer: X-Stream-Error
OKHTTP: Vary: Origin
OKHTTP: Date: Tue, 26 Feb 2019 03:18:31 GMT
OKHTTP: Transfer-Encoding: chunked
OKHTTP: {"Message":"failed to get block for QmZC6gALejeRt2TAHHMnEkcEXeyX3XUSZ4yRkpt43UkM5A: context deadline exceeded","Code":0,"Type":"error"}
OKHTTP: <-- END HTTP (136-byte body)