@@ -232,59 +232,62 @@ TEST_FIXTURE(uri_address, outside_ssl_json)
232
232
// Send request
233
233
web::http::client::http_client playlistClient (playlistUri.to_uri ());
234
234
235
- // Retry up to 4 times.
236
- for (int i = 0 ; i < 4 ; ++i)
235
+ handle_timeout ([]
237
236
{
238
- try
237
+ // Retry up to 4 times.
238
+ for (int i = 0 ; i < 4 ; ++i)
239
239
{
240
- playlistClient.request (methods::GET).then ([=](http_response playlistResponse) -> pplx::task < json::value >
241
- {
242
- return playlistResponse.extract_json ();
243
- }).then ([=](json::value v)
240
+ try
244
241
{
245
- int count = 0 ;
246
- auto & obj = v.as_object ();
242
+ playlistClient.request (methods::GET).then ([=](http_response playlistResponse) -> pplx::task < json::value >
243
+ {
244
+ return playlistResponse.extract_json ();
245
+ }).then ([=](json::value v)
246
+ {
247
+ int count = 0 ;
248
+ auto & obj = v.as_object ();
247
249
248
- VERIFY_ARE_NOT_EQUAL (obj.find (U (" pageInfo" )), obj.end ());
249
- VERIFY_ARE_NOT_EQUAL (obj.find (U (" items" )), obj.end ());
250
+ VERIFY_ARE_NOT_EQUAL (obj.find (U (" pageInfo" )), obj.end ());
251
+ VERIFY_ARE_NOT_EQUAL (obj.find (U (" items" )), obj.end ());
250
252
251
- auto & items = obj[U (" items" )];
253
+ auto & items = obj[U (" items" )];
252
254
253
- for (auto iter = items.as_array ().cbegin (); iter != items.as_array ().cend (); ++iter)
254
- {
255
- const auto & item = *iter;
256
- auto iSnippet = item.as_object ().find (U (" snippet" ));
257
- if (iSnippet == item.as_object ().end ())
255
+ for (auto iter = items.as_array ().cbegin (); iter != items.as_array ().cend (); ++iter)
258
256
{
259
- throw std::runtime_error (" snippet key not found" );
257
+ const auto & item = *iter;
258
+ auto iSnippet = item.as_object ().find (U (" snippet" ));
259
+ if (iSnippet == item.as_object ().end ())
260
+ {
261
+ throw std::runtime_error (" snippet key not found" );
262
+ }
263
+ auto iTitle = iSnippet->second .as_object ().find (U (" title" ));
264
+ if (iTitle == iSnippet->second .as_object ().end ())
265
+ {
266
+ throw std::runtime_error (" title key not found" );
267
+ }
268
+ auto name = iTitle->second .serialize ();
269
+ count++;
260
270
}
261
- auto iTitle = iSnippet->second .as_object ().find (U (" title" ));
262
- if (iTitle == iSnippet->second .as_object ().end ())
263
- {
264
- throw std::runtime_error (" title key not found" );
265
- }
266
- auto name = iTitle->second .serialize ();
267
- count++;
268
- }
269
- VERIFY_ARE_EQUAL (3 , count); // Update this accordingly, if the number of items changes
270
- }).wait ();
271
- break ;
272
- }
273
- catch (web::http::http_exception const & e)
274
- {
275
- #if defined(_MSC_VER) && !defined(__cplusplus_winrt)
276
- if (e.error_code ().value () != API_QUERY_DATA_AVAILABLE || i == 3 )
277
- {
278
- // If we didn't get a "connection broken" error (or we are on the last retry), rethrow it
279
- throw ;
271
+ VERIFY_ARE_EQUAL (3 , count); // Update this accordingly, if the number of items changes
272
+ }).wait ();
273
+ break ;
280
274
}
275
+ catch (web::http::http_exception const & e)
276
+ {
277
+ #if defined(_MSC_VER) && !defined(__cplusplus_winrt)
278
+ if (e.error_code ().value () != API_QUERY_DATA_AVAILABLE || i == 3 )
279
+ {
280
+ // If we didn't get a "connection broken" error (or we are on the last retry), rethrow it
281
+ throw ;
282
+ }
281
283
#else
282
- CASABLANCA_UNREFERENCED_PARAMETER (e);
283
- throw ;
284
+ CASABLANCA_UNREFERENCED_PARAMETER (e);
285
+ throw ;
284
286
#endif
285
- os_utilities::sleep (1000 );
287
+ os_utilities::sleep (1000 );
288
+ }
286
289
}
287
- }
290
+ });
288
291
}
289
292
290
293
} // SUITE(outside_tests)
0 commit comments