From 456575818e6993e95f2b7f9343aafd3f69958bc8 Mon Sep 17 00:00:00 2001 From: "corrado.mulas" Date: Wed, 20 Nov 2024 03:53:19 +0100 Subject: [PATCH] First commit --- overleaf.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/overleaf.go b/overleaf.go index 8668722..535534b 100644 --- a/overleaf.go +++ b/overleaf.go @@ -20,10 +20,9 @@ type Overleaf struct { } func NewOverleaf(baseURL string) *Overleaf { - // Create a new HTTP client with a cookie jar - jar, _ := cookiejar.New(nil) + jar, _ := cookiejar.New(nil) // Create a cookie jar to store cookies client := &http.Client{ - Jar: jar, + Jar: jar, // Attach the cookie jar to the client } return &Overleaf{ @@ -60,12 +59,7 @@ func (o *Overleaf) post(endpoint string, data map[string]string) (*http.Response // Log cookies for debugging cookies := o.Client.Jar.Cookies(req.URL) for _, cookie := range cookies { - log.Printf("Cookie sent: %s=%s", cookie.Name, cookie.Value) - } - - // Include cookies in the request - for _, cookie := range cookies { - req.AddCookie(cookie) + log.Printf("Cookie sent to %s: %s=%s", endpoint, cookie.Name, cookie.Value) } return o.Client.Do(req)