Skip to content
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

change get api deal with the 500 code #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

change get api deal with the 500 code #10

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Feb 26, 2019

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)

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.
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.

0 participants