@@ -8,17 +8,19 @@ import (
88// RequestRepeat is a function for set options in request
99// if response.Code != Expect.Code, than request will repeat Count counts with Delay delay.
1010// Default delay is 1 second.
11+ // Deprecated: use RequestRetry instead
1112func (qt * cute ) RequestRepeat (count int ) RequestHTTPBuilder {
12- qt .tests [qt .countTests ].Request .Repeat .Count = count
13+ qt .tests [qt .countTests ].Request .Retry .Count = count
1314
1415 return qt
1516}
1617
1718// RequestRepeatDelay set delay for request repeat.
1819// if response.Code != Expect.Code, than request will repeat Count counts with Delay delay.
1920// Default delay is 1 second.
21+ // Deprecated: use RequestRetryDelay instead
2022func (qt * cute ) RequestRepeatDelay (delay time.Duration ) RequestHTTPBuilder {
21- qt .tests [qt .countTests ].Request .Repeat .Delay = delay
23+ qt .tests [qt .countTests ].Request .Retry .Delay = delay
2224
2325 return qt
2426}
@@ -27,28 +29,84 @@ func (qt *cute) RequestRepeatDelay(delay time.Duration) RequestHTTPBuilder {
2729// if response.Code != Expect.Code, than request will repeat Count counts with Delay delay.
2830// if Optional is true and request is failed, than test step allure will be skipped, and t.Fail() will not execute.
2931// If Broken is true and request is failed, than test step allure will be broken, and t.Fail() will not execute.
32+ // Deprecated: use RequestRetryPolitic instead
3033func (qt * cute ) RequestRepeatPolitic (politic * RequestRepeatPolitic ) RequestHTTPBuilder {
3134 if politic == nil {
32- panic ("politic is nil in RequestRepeatPolitic " )
35+ panic ("politic is nil in RequestRetryPolitic " )
3336 }
3437
35- qt .tests [qt .countTests ].Request .Repeat = politic
38+ qt .tests [qt .countTests ].Request .Retry = & RequestRetryPolitic {
39+ Count : politic .Count ,
40+ Delay : politic .Delay ,
41+ Optional : politic .Optional ,
42+ Broken : politic .Broken ,
43+ }
3644
3745 return qt
3846}
3947
4048// RequestRepeatOptional set option politic for request repeat.
4149// if Optional is true and request is failed, than test step allure will be skipped, and t.Fail() will not execute.
50+ // Deprecated: use RequestRetryOptional instead
4251func (qt * cute ) RequestRepeatOptional (option bool ) RequestHTTPBuilder {
43- qt .tests [qt .countTests ].Request .Repeat .Optional = option
52+ qt .tests [qt .countTests ].Request .Retry .Optional = option
4453
4554 return qt
4655}
4756
4857// RequestRepeatBroken set broken politic for request repeat.
4958// If Broken is true and request is failed, than test step allure will be broken, and t.Fail() will not execute.
59+ // Deprecated: use RequestRetryBroken instead
5060func (qt * cute ) RequestRepeatBroken (broken bool ) RequestHTTPBuilder {
51- qt .tests [qt .countTests ].Request .Repeat .Broken = broken
61+ qt .tests [qt .countTests ].Request .Retry .Broken = broken
62+
63+ return qt
64+ }
65+
66+ // RequestRetry is a function for set options in request
67+ // if response.Code != Expect.Code, than request will repeat Count counts with Delay delay.
68+ // Default delay is 1 second.
69+ func (qt * cute ) RequestRetry (count int ) RequestHTTPBuilder {
70+ qt .tests [qt .countTests ].Request .Retry .Count = count
71+
72+ return qt
73+ }
74+
75+ // RequestRetryDelay set delay for request repeat.
76+ // if response.Code != Expect.Code, than request will repeat Count counts with Delay delay.
77+ // Default delay is 1 second.
78+ func (qt * cute ) RequestRetryDelay (delay time.Duration ) RequestHTTPBuilder {
79+ qt .tests [qt .countTests ].Request .Retry .Delay = delay
80+
81+ return qt
82+ }
83+
84+ // RequestRetryPolitic set politic for request repeat.
85+ // if response.Code != Expect.Code, than request will repeat Count counts with Delay delay.
86+ // if Optional is true and request is failed, than test step allure will be skipped, and t.Fail() will not execute.
87+ // If Broken is true and request is failed, than test step allure will be broken, and t.Fail() will not execute.
88+ func (qt * cute ) RequestRetryPolitic (politic * RequestRetryPolitic ) RequestHTTPBuilder {
89+ if politic == nil {
90+ panic ("politic is nil in RequestRetryPolitic" )
91+ }
92+
93+ qt .tests [qt .countTests ].Request .Retry = politic
94+
95+ return qt
96+ }
97+
98+ // RequestRetryOptional set option politic for request repeat.
99+ // if Optional is true and request is failed, than test step allure will be skipped, and t.Fail() will not execute.
100+ func (qt * cute ) RequestRetryOptional (option bool ) RequestHTTPBuilder {
101+ qt .tests [qt .countTests ].Request .Retry .Optional = option
102+
103+ return qt
104+ }
105+
106+ // RequestRetryBroken set broken politic for request repeat.
107+ // If Broken is true and request is failed, than test step allure will be broken, and t.Fail() will not execute.
108+ func (qt * cute ) RequestRetryBroken (broken bool ) RequestHTTPBuilder {
109+ qt .tests [qt .countTests ].Request .Retry .Broken = broken
52110
53111 return qt
54112}
0 commit comments