From bbddab97226f1ded19bff48e4bb0fb327f261385 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Wed, 11 Apr 2018 15:34:06 +0200 Subject: [PATCH] Added status code check --- jobs/download-character-images/download-character-images.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/jobs/download-character-images/download-character-images.go b/jobs/download-character-images/download-character-images.go index b1060a2c..38485e33 100644 --- a/jobs/download-character-images/download-character-images.go +++ b/jobs/download-character-images/download-character-images.go @@ -2,6 +2,7 @@ package main import ( "fmt" + "net/http" "sort" "time" @@ -52,6 +53,11 @@ func download(characterID string) { return } + if response.StatusCode() != http.StatusOK { + color.Red("Status: %d", response.StatusCode()) + return + } + err = character.SetImageBytes(response.Bytes()) if err != nil {