You've already forked top-wallpaper
update-deps (#1)
Reviewed-on: #1 Co-authored-by: Ron Rise <ron@siteworxpro.com> Co-committed-by: Ron Rise <ron@siteworxpro.com>
This commit was merged in pull request #1.
This commit is contained in:
@@ -60,15 +60,16 @@ func GetLatestImage(httpGet func(url string) (*http.Response, error)) (string, e
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer func(Body io.ReadCloser) {
|
||||
_ = Body.Close()
|
||||
}(response.Body)
|
||||
defer response.Body.Close()
|
||||
|
||||
if response.StatusCode != http.StatusOK {
|
||||
return "", fmt.Errorf("error fetching reddit data: %s", response.Status)
|
||||
}
|
||||
|
||||
jsonBytes, err := io.ReadAll(response.Body)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
redditData := redditResponse{}
|
||||
err = json.Unmarshal(jsonBytes, &redditData)
|
||||
|
||||
Reference in New Issue
Block a user