Check for response status when fetching credentials

This commit is contained in:
Dan Sosedoff 2017-09-15 19:23:00 -05:00
parent 168b33d5d5
commit 0aff72059b

View File

@ -84,6 +84,11 @@ func ConnectWithBackend(c *gin.Context) {
}
defer resp.Body.Close()
if resp.StatusCode != 200 {
c.JSON(400, Error{"Unable to fetch connection settings"})
return
}
data, err := ioutil.ReadAll(resp.Body)
if err != nil {
c.JSON(400, err)