Skip to content

Commit

Permalink
fix(handler): check http status code
Browse files Browse the repository at this point in the history
  • Loading branch information
DreamOneX committed Aug 1, 2022
1 parent db428ff commit be8bdf8
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ public void run() {
InputStream stream;
try (Response response = client.newCall(request).execute()) {
stream = response.body().byteStream();
if (response.code() != 404) {
target.sendMessage("404 Not Found");
return;
} else if (response.code() != 200) {
target.sendMessage("奇怪的错误,检查你的url");
return;
}
ExternalResource res = ExternalResource
.create(stream);
Image image = target.uploadImage(res);
Expand Down

0 comments on commit be8bdf8

Please sign in to comment.