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

Function Post

Ghttp/http.go:198–221  ·  view source on GitHub ↗
(url string, data interface{}, proxy string, headers Headers)

Source from the content-addressed store, hash-verified

196
197}
198func Post(url string, data interface{}, proxy string, headers Headers) ([]byte, error) {
199 http := New()
200 http.Post(url, data)
201 for k, v := range headers {
202 http.SetHeader(k, v)
203 }
204 if proxy != "" {
205 http.SetProxy(proxy)
206 }
207 http.IgnoreSSL()
208 if strings.HasPrefix(data.(string), "{") == false {
209 http.SetContentType("form")
210 }
211 http.Execute()
212 if http.HttpResponse.Header.Get("Content-Encoding") == "gzip" {
213 reader, err := gzip.NewReader(http.HttpResponse.Body)
214 if err != nil {
215 return nil, err
216 }
217 defer reader.Close()
218 return ioutil.ReadAll(reader)
219 }
220 return http.Byte()
221}

Callers

nothing calls this directly

Calls 10

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

Tested by

no test coverage detected