MCPcopy Create free account
hub / github.com/deepflowio/deepflow / CURLPostFormData

Function CURLPostFormData

cli/ctl/common/http_util.go:131–151  ·  view source on GitHub ↗
(url, contentType string, body *bytes.Buffer, opts ...HTTPOption)

Source from the content-addressed store, hash-verified

129}
130
131func CURLPostFormData(url, contentType string, body *bytes.Buffer, opts ...HTTPOption) (*simplejson.Json, error) {
132 cfg := &HTTPConf{}
133 for _, opt := range opts {
134 opt(cfg)
135 }
136
137 req, err := http.NewRequest("POST", url, body)
138 if err != nil {
139 return nil, err
140 }
141 if cfg.ORGID != 0 {
142 req.Header.Set(HEADER_KEY_X_ORG_ID, strconv.Itoa(cfg.ORGID))
143 }
144 req.Header.Set("Content-Type", contentType)
145 req.Header.Set("Accept", "application/json, text/plain")
146 req.Header.Set("X-User-Id", "1")
147 req.Header.Set("X-User-Type", "1")
148 req.Close = true
149
150 return parseResponse(req, cfg)
151}
152
153func CURLResponseRawJson(method string, url string, opts ...HTTPOption) (*simplejson.Json, error) {
154 cfg := &HTTPConf{}

Callers

nothing calls this directly

Calls 2

parseResponseFunction · 0.85
SetMethod · 0.65

Tested by

no test coverage detected