Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
fix: set referer
Browse files Browse the repository at this point in the history
  • Loading branch information
thde committed Nov 15, 2023
1 parent 67bee41 commit 69daf6e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/zenduty/zenduty.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ func (c *Client) Login(ctx context.Context) error {
c.http.Jar = jar
}

res, err := c.http.Get(fmt.Sprintf("%s/login/", c.baseURL))
loginURL := fmt.Sprintf("%s/login/", c.baseURL)
res, err := c.http.Get(loginURL)
if err != nil {
return fmt.Errorf("error getting login page: %w", err)
}
Expand All @@ -131,6 +132,8 @@ func (c *Client) Login(ctx context.Context) error {
if err != nil {
return fmt.Errorf("error creating login request: %w", err)
}
req.Header.Set("Referer", loginURL)

resp := &loginResponse{}
if err = c.do(req, resp); err != nil {
return fmt.Errorf("error logging in: %w", err)
Expand Down

0 comments on commit 69daf6e

Please sign in to comment.