fix(lastfm): send parameters in request body for POST requests in scrobble and updateNowPlaying methods

Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
Deluan
2026-01-26 20:13:04 -05:00
parent fda35dd8ce
commit 51026de80b
3 changed files with 86 additions and 6 deletions
+9 -2
View File
@@ -198,8 +198,15 @@ func (c *client) makeRequest(ctx context.Context, method string, params url.Valu
c.sign(params)
}
req, _ := http.NewRequestWithContext(ctx, method, apiBaseUrl, nil)
req.URL.RawQuery = params.Encode()
var req *http.Request
if method == http.MethodPost {
body := strings.NewReader(params.Encode())
req, _ = http.NewRequestWithContext(ctx, method, apiBaseUrl, body)
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
} else {
req, _ = http.NewRequestWithContext(ctx, method, apiBaseUrl, nil)
req.URL.RawQuery = params.Encode()
}
log.Trace(ctx, fmt.Sprintf("Sending Last.fm %s request", req.Method), "url", req.URL)
resp, err := c.hc.Do(req)