MCPcopy Index your code
hub / github.com/imroc/req / TestSetFileWithRetry

Function TestSetFileWithRetry

request_test.go:953–967  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

951}
952
953func TestSetFileWithRetry(t *testing.T) {
954 resp, err := tc().R().
955 SetRetryCount(3).
956 SetRetryCondition(func(resp *Response, err error) bool {
957 return err != nil || resp.StatusCode > 499
958 }).
959 SetRetryHook(func(resp *Response, err error) {
960 resp.Request.SetQueryParam("attempt", strconv.Itoa(resp.Request.RetryAttempt))
961 }).
962 SetFile("file", tests.GetTestFilePath("sample-file.txt")).
963 SetQueryParam("attempt", "0").
964 Post("/file-text")
965 assertSuccess(t, resp, err)
966 tests.AssertEqual(t, 2, resp.Request.RetryAttempt)
967}
968
969func TestSetFile(t *testing.T) {
970 filename := "sample-file.txt"

Callers

nothing calls this directly

Calls 11

GetTestFilePathFunction · 0.92
AssertEqualFunction · 0.92
tcFunction · 0.85
assertSuccessFunction · 0.85
SetQueryParamMethod · 0.80
SetFileMethod · 0.80
SetRetryHookMethod · 0.80
SetRetryConditionMethod · 0.80
SetRetryCountMethod · 0.80
RMethod · 0.80
PostMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…