Add function to refresh session
This commit is contained in:
parent
51d0d1d811
commit
4b4736c68d
|
@ -0,0 +1,23 @@
|
|||
package sn
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func RefreshSession() error {
|
||||
req, err := http.NewRequest("GET", SnUrl+"/api/auth/session", nil)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("error preparing SN request: %w", err)
|
||||
return err
|
||||
}
|
||||
req.Header.Set("Cookie", SnAuthCookie)
|
||||
|
||||
client := http.DefaultClient
|
||||
_, err = client.Do(req)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("error refreshing SN session: %w", err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
Loading…
Reference in New Issue