(url, contentType string, body *bytes.Buffer, opts ...HTTPOption)
| 129 | } |
| 130 | |
| 131 | func 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 | |
| 153 | func CURLResponseRawJson(method string, url string, opts ...HTTPOption) (*simplejson.Json, error) { |
| 154 | cfg := &HTTPConf{} |
nothing calls this directly
no test coverage detected