MCPcopy Index your code
hub / github.com/code-scan/Goal / Get

Function Get

Ghttp/http.go:172–197  ·  view source on GitHub ↗
(url, proxy string, headers Headers)

Source from the content-addressed store, hash-verified

170}
171
172func Get(url, proxy string, headers Headers) ([]byte, error) {
173 http := New()
174 http.Get(url)
175 for k, v := range headers {
176 http.SetHeader(k, v)
177 }
178 if proxy != "" {
179 http.SetProxy(proxy)
180 }
181 http.IgnoreSSL()
182 http.SetTimeOut(30)
183 resp := http.Execute()
184 if resp == nil {
185 return nil, fmt.Errorf("http connect error")
186 }
187 if http.HttpResponse.Header.Get("Content-Encoding") == "gzip" {
188 reader, err := gzip.NewReader(http.HttpResponse.Body)
189 if err != nil {
190 return nil, err
191 }
192 defer reader.Close()
193 return ioutil.ReadAll(reader)
194 }
195 return http.Byte()
196
197}
198func Post(url string, data interface{}, proxy string, headers Headers) ([]byte, error) {
199 http := New()
200 http.Post(url, data)

Callers

nothing calls this directly

Calls 9

NewFunction · 0.85
GetMethod · 0.80
SetHeaderMethod · 0.80
SetProxyMethod · 0.80
IgnoreSSLMethod · 0.80
SetTimeOutMethod · 0.80
ExecuteMethod · 0.80
ByteMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected