File tree Expand file tree Collapse file tree 2 files changed +19
-4
lines changed
tests/functional/http/client Expand file tree Collapse file tree 2 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -191,11 +191,20 @@ class http_client_config
191
191
// / Get the timeout
192
192
// / </summary>
193
193
// / <returns>The timeout (in seconds) used for each send and receive operation on the client.</returns>
194
- const auto & timeout () const
194
+ utility::seconds timeout () const
195
195
{
196
- return m_timeout;
196
+ return std::chrono::duration_cast<utility::seconds>( m_timeout) ;
197
197
}
198
198
199
+ // / <summary>
200
+ // / Get the timeout
201
+ // / </summary>
202
+ // / <returns>The timeout (in whatever duration) used for each send and receive operation on the client.</returns>
203
+ template <class T >
204
+ T timeout () const
205
+ {
206
+ return std::chrono::duration_cast<T>(m_timeout);
207
+ }
199
208
// / <summary>
200
209
// / Set the timeout
201
210
// / </summary>
Original file line number Diff line number Diff line change @@ -171,8 +171,14 @@ TEST_FIXTURE(uri_address, get_client_config)
171
171
http_client client (m_uri, config);
172
172
173
173
const http_client_config& config2 = client.client_config ();
174
- VERIFY_ARE_EQUAL (std::chrono::duration_cast<decltype (timeout)>(config2.timeout ()).count (),
175
- timeout.count ());
174
+ VERIFY_ARE_EQUAL (config2.timeout ().count (), timeout.count ());
175
+ std::chrono::milliseconds milli_timeout = config2.timeout ();
176
+ VERIFY_ARE_EQUAL (milli_timeout.count (),
177
+ std::chrono::duration_cast<std::chrono::milliseconds>(timeout).count ());
178
+ auto micro_timeout = config.timeout <std::chrono::microseconds>();
179
+ VERIFY_ARE_EQUAL (micro_timeout.count (),
180
+ std::chrono::duration_cast<std::chrono::microseconds>(timeout).count ());
181
+
176
182
VERIFY_ARE_EQUAL (config2.chunksize (), 1024 );
177
183
}
178
184
You can’t perform that action at this time.
0 commit comments