check errors when creating request

related #494
This commit is contained in:
sentriz
2024-04-07 17:53:12 +01:00
parent 8a0fa05c7c
commit cc4c57be98
2 changed files with 10 additions and 2 deletions

View File

@@ -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)