diff --git a/lastfm/client.go b/lastfm/client.go index b718726e..6cf3d97e 100644 --- a/lastfm/client.go +++ b/lastfm/client.go @@ -291,7 +291,11 @@ func (c *Client) GetCurrentUser(user *db.User) (User, error) { } func (c *Client) makeRequest(method string, params url.Values) (LastFM, error) { - req, _ := http.NewRequest(method, BaseURL, nil) + req, err := http.NewRequest(method, BaseURL, nil) + if err != nil { + return LastFM{}, fmt.Errorf("create request: %w", err) + } + req.URL.RawQuery = params.Encode() resp, err := c.httpClient.Do(req) diff --git a/listenbrainz/listenbrainz.go b/listenbrainz/listenbrainz.go index 61db7e55..8d1da451 100644 --- a/listenbrainz/listenbrainz.go +++ b/listenbrainz/listenbrainz.go @@ -75,7 +75,11 @@ func (c *Client) Scrobble(user db.User, track scrobble.Track, stamp time.Time, s submitURL := fmt.Sprintf("%s%s", user.ListenBrainzURL, submitPath) authHeader := fmt.Sprintf("Token %s", user.ListenBrainzToken) - req, _ := http.NewRequest(http.MethodPost, submitURL, &payloadBuf) + req, err := http.NewRequest(http.MethodPost, submitURL, &payloadBuf) + if err != nil { + return fmt.Errorf("create submit request: %w", err) + } + req.Header.Add("Content-Type", "application/json") req.Header.Add("Authorization", authHeader)