Commit 850b678981

850b678981f19fe9c9ab824f01fb3d1acb9999b2

parent: e657ad8188

Unsigned

Wraient <wraient.911@gmail.com> · 2024-10-21 14:54 UTC

Fix: Make request works

Layout: unified · split

internal/anilist.go +2 −1
@@ -197,7 +197,7 @@ func GetAnimeMalID(anilistMediaID int) (int, error) {
197 return malID, nil 197 return malID, nil
198} 198}
199 199
200// Function to get AniList media ID and image 200// This function retrieves the MAL ID and cover image URL for an anime from AniList
201func GetAnimeIDAndImage(anilistMediaID int) (int, string, error) { 201func GetAnimeIDAndImage(anilistMediaID int) (int, string, error) {
202 url := "https://graphql.anilist.co" 202 url := "https://graphql.anilist.co"
203 query := ` 203 query := `
@@ -391,6 +391,7 @@ func makePostRequest(url, query string, variables map[string]interface{}, header
391 return nil, fmt.Errorf("failed to create request: %w", err) 391 return nil, fmt.Errorf("failed to create request: %w", err)
392 } 392 }
393 393
394 req.Header.Set("Content-Type", "application/json") // <-- Important!
394 for key, value := range headers { 395 for key, value := range headers {
395 req.Header.Set(key, value) 396 req.Header.Set(key, value)
396 } 397 }