Skip to content
This repository was archived by the owner on Jan 29, 2025. It is now read-only.

Commit e88bdf1

Browse files
committed
fix: add authentication cookie only if available
1 parent 389911f commit e88bdf1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Diff for: monstercat/release.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ func (client Client) DownloadRelease(release Release, downloadFormat DownloadFor
5959
if err != nil {
6060
return err
6161
}
62-
request.Header.Set("Cookie", fmt.Sprintf("%s=%s", authenticationCookieName, client.authenticationCookie))
62+
if client.IsLoggedIn() {
63+
request.Header.Set("Cookie", fmt.Sprintf("%s=%s", authenticationCookieName, client.authenticationCookie))
64+
}
6365

6466
httpClient := &http.Client{}
6567
response, err := httpClient.Do(request)

Diff for: monstercat/release_list.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ func (client Client) ReleaseListAtPosition(limit int, offset int) (ReleaseList,
2828
if err != nil {
2929
return releaseList, err
3030
}
31-
request.Header.Set("Cookie", fmt.Sprintf("%s=%s", authenticationCookieName, client.authenticationCookie))
31+
if client.IsLoggedIn() {
32+
request.Header.Set("Cookie", fmt.Sprintf("%s=%s", authenticationCookieName, client.authenticationCookie))
33+
}
3234

3335
httpClient := &http.Client{}
3436
response, err := httpClient.Do(request)

0 commit comments

Comments
 (0)