SimpleGET 简单的 GET 请求
(_url string, params map[string]string)
| 17 | |
| 18 | // SimpleGET 简单的 GET 请求 |
| 19 | func (client *BiliClient) SimpleGET(_url string, params map[string]string) (*http.Response, error) { |
| 20 | values := url.Values{} |
| 21 | for k, v := range params { |
| 22 | values.Set(k, v) |
| 23 | } |
| 24 | _client := http.Client{ |
| 25 | Transport: &http.Transport{ |
| 26 | Proxy: http.ProxyURL(nil), |
| 27 | }, |
| 28 | } |
| 29 | request, err := http.NewRequest("GET", _url+"?"+values.Encode(), nil) |
| 30 | if err != nil { |
| 31 | return nil, err |
| 32 | } |
| 33 | request.Header = client.MakeHeader() |
| 34 | return _client.Do(request) |
| 35 | } |
| 36 | |
| 37 | // MakeHeader 生成请求头 |
| 38 | func (client *BiliClient) MakeHeader() http.Header { |
no test coverage detected