(request *http.Request)
| 30 | ) |
| 31 | |
| 32 | func (c *QQClient) SendRequestWithCookie(request *http.Request) (*http.Response, error) { |
| 33 | u, err := url.Parse(request.URL.String()) |
| 34 | if err != nil { |
| 35 | return nil, err |
| 36 | } |
| 37 | cookies, err := c.GetCookies(u.Hostname()) |
| 38 | if err != nil { |
| 39 | return nil, err |
| 40 | } |
| 41 | request.AddCookie(&http.Cookie{Name: "skey", Value: cookies.SKey}) |
| 42 | request.AddCookie(&http.Cookie{Name: "p_uin", Value: strconv.Itoa(int(cookies.uin))}) |
| 43 | request.AddCookie(&http.Cookie{Name: "p_skey", Value: cookies.PsKey}) |
| 44 | return c.ticket.client.Do(request) |
| 45 | } |
| 46 | |
| 47 | func (c *QQClient) GetSkey() (string, error) { |
| 48 | if time.Now().Before(c.ticket.sKey.expireTime) { |
no test coverage detected