MCPcopy Create free account
hub / github.com/OpenAtomFoundation/SmartIDE / postRetry

Function postRetry

cli/pkg/common/http.go:127–149  ·  view source on GitHub ↗
(target HttpClient, reqUrl string,
	reqParams map[string]interface{}, contentType string, files []UploadFile, headers map[string]string)

Source from the content-addressed store, hash-verified

125}
126
127func postRetry(target HttpClient, reqUrl string,
128 reqParams map[string]interface{}, contentType string, files []UploadFile, headers map[string]string) (string, error) {
129 result := ""
130 var err error = nil
131
132 if target.Sleep > 0 {
133 defaultTimeout = target.Sleep
134 }
135
136 Retry(target.RetryMax, target.Sleep, func() error {
137 result, err = target.post(reqUrl, reqParams, contentType, files, headers)
138 if err == nil {
139 if result == "" {
140 err = errors.New("response body is empty")
141 } else if !IsJSON(result) && contentType == "application/json" {
142 err = errors.New("response body is not json")
143 }
144 }
145 return err
146 })
147
148 return result, err
149}
150
151type UploadFile struct {
152 // 表单名称

Callers 3

PostJsonMethod · 0.85
PostFormMethod · 0.85
PostFileMethod · 0.85

Calls 3

RetryFunction · 0.85
IsJSONFunction · 0.85
postMethod · 0.80

Tested by

no test coverage detected