@@ -862,37 +862,6 @@ If you use for example
862
862
as the type and name of an argument, autowiring will inject the ``my_api.client ``
863
863
service into your autowired classes.
864
864
865
- .. _reference-http-client-retry-failed :
866
-
867
- By enabling the optional ``retry_failed `` configuration, the HTTP client service
868
- will automatically retry failed HTTP requests.
869
-
870
- .. code-block :: yaml
871
-
872
- # config/packages/framework.yaml
873
- framework :
874
- # ...
875
- http_client :
876
- # ...
877
- default_options :
878
- retry_failed :
879
- # retry_strategy: app.custom_strategy
880
- http_codes :
881
- 0 : ['GET', 'HEAD'] # retry network errors if request method is GET or HEAD
882
- 429 : true # retry all responses with 429 status code
883
- 500 : ['GET', 'HEAD']
884
- max_retries : 2
885
- delay : 1000
886
- multiplier : 3
887
- max_delay : 5000
888
- jitter : 0.3
889
-
890
- scoped_clients :
891
- my_api.client :
892
- # ...
893
- retry_failed :
894
- max_retries : 4
895
-
896
865
auth_basic
897
866
..........
898
867
@@ -1003,6 +972,12 @@ crypto_method
1003
972
The minimum version of TLS to accept. The value must be one of the
1004
973
``STREAM_CRYPTO_METHOD_TLSv*_CLIENT `` constants defined by PHP.
1005
974
975
+ .. versionadded :: 6.3
976
+
977
+ The ``crypto_method `` option was introduced in Symfony 6.3.
978
+
979
+ .. _reference-http-client-retry-delay :
980
+
1006
981
delay
1007
982
.....
1008
983
@@ -1038,6 +1013,8 @@ headers
1038
1013
An associative array of the HTTP headers added before making the request. This
1039
1014
value must use the format ``['header-name' => 'value0, value1, ...'] ``.
1040
1015
1016
+ .. _reference-http-client-retry-http-codes :
1017
+
1041
1018
http_codes
1042
1019
..........
1043
1020
@@ -1053,6 +1030,8 @@ http_version
1053
1030
The HTTP version to use, typically ``'1.1' `` or ``'2.0' ``. Leave it to ``null ``
1054
1031
to let Symfony select the best version automatically.
1055
1032
1033
+ .. _reference-http-client-retry-jitter :
1034
+
1056
1035
jitter
1057
1036
......
1058
1037
@@ -1080,6 +1059,8 @@ local_pk
1080
1059
The path of a file that contains the `PEM formatted `_ private key of the
1081
1060
certificate defined in the ``local_cert `` option.
1082
1061
1062
+ .. _reference-http-client-retry-max-delay :
1063
+
1083
1064
max_delay
1084
1065
.........
1085
1066
@@ -1114,6 +1095,8 @@ max_redirects
1114
1095
The maximum number of redirects to follow. Use ``0 `` to not follow any
1115
1096
redirection.
1116
1097
1098
+ .. _reference-http-client-retry-max-retries :
1099
+
1117
1100
max_retries
1118
1101
...........
1119
1102
@@ -1122,6 +1105,8 @@ max_retries
1122
1105
The maximum number of retries for failing requests. When the maximum is reached,
1123
1106
the client returns the last received response.
1124
1107
1108
+ .. _reference-http-client-retry-multiplier :
1109
+
1125
1110
multiplier
1126
1111
..........
1127
1112
@@ -1189,6 +1174,54 @@ client and to make your tests easier.
1189
1174
The value of this option is an associative array of ``domain => IP address ``
1190
1175
(e.g ``['symfony.com' => '46.137.106.254', ...] ``).
1191
1176
1177
+ .. _reference-http-client-retry-failed :
1178
+
1179
+ retry_failed
1180
+ ............
1181
+
1182
+ **type **: ``array ``
1183
+
1184
+ .. versionadded :: 5.2
1185
+
1186
+ The ``retry_failed `` option was introduced in Symfony 5.2.
1187
+
1188
+ This option configures the behavior of the HTTP client when some request fails,
1189
+ including which types of requests to retry and how many times. The behavior is
1190
+ defined with the following options:
1191
+
1192
+ * :ref: `delay <reference-http-client-retry-delay >`
1193
+ * :ref: `http_codes <reference-http-client-retry-http-codes >`
1194
+ * :ref: `jitter <reference-http-client-retry-jitter >`
1195
+ * :ref: `max_delay <reference-http-client-retry-max-delay >`
1196
+ * :ref: `max_retries <reference-http-client-retry-max-retries >`
1197
+ * :ref: `multiplier <reference-http-client-retry-multiplier >`
1198
+
1199
+ .. code-block :: yaml
1200
+
1201
+ # config/packages/framework.yaml
1202
+ framework :
1203
+ # ...
1204
+ http_client :
1205
+ # ...
1206
+ default_options :
1207
+ retry_failed :
1208
+ # retry_strategy: app.custom_strategy
1209
+ http_codes :
1210
+ 0 : ['GET', 'HEAD'] # retry network errors if request method is GET or HEAD
1211
+ 429 : true # retry all responses with 429 status code
1212
+ 500 : ['GET', 'HEAD']
1213
+ max_retries : 2
1214
+ delay : 1000
1215
+ multiplier : 3
1216
+ max_delay : 5000
1217
+ jitter : 0.3
1218
+
1219
+ scoped_clients :
1220
+ my_api.client :
1221
+ # ...
1222
+ retry_failed :
1223
+ max_retries : 4
1224
+
1192
1225
retry_strategy
1193
1226
..............
1194
1227
0 commit comments