Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6b51a82

Browse files
committed
Updated client_options tests.
1 parentfb7eecf commit6b51a82

File tree

2 files changed

+32
-7
lines changed

2 files changed

+32
-7
lines changed

‎http/src/network/http/v2/client_options.hpp‎

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
#include<cstdint>
1010
#include<algorithm>
11+
#include<string>
12+
#include<vector>
13+
#include<chrono>
1114

1215
namespacenetwork {
1316
namespacehttp {
@@ -17,7 +20,7 @@ namespace v2 {
1720
public:
1821

1922
// default timeout is 30 seconds
20-
constexprclient_options()
23+
client_options()
2124
: follow_redirects_(false)
2225
, cache_resolved_(false)
2326
, use_proxy_(false)
@@ -36,14 +39,16 @@ namespace v2 {
3639
std::swap(cache_resolved_, other.cache_resolved_);
3740
std::swap(use_proxy_, other.use_proxy_);
3841
std::swap(timeout_, other.timeout_);
42+
std::swap(openssl_certificate_paths_, other.openssl_certificate_paths_);
43+
std::swap(openssl_verify_paths_, other.openssl_verify_paths_);
3944
}
4045

4146
client_options &follow_redirects(bool follow_redirects)noexcept {
4247
follow_redirects_ = follow_redirects;
4348
return *this;
4449
}
4550

46-
constexprboolfollow_redirects()constnoexcept {
51+
boolfollow_redirects()constnoexcept {
4752
return follow_redirects_;
4853
}
4954

@@ -52,7 +57,7 @@ namespace v2 {
5257
return *this;
5358
}
5459

55-
constexprboolcache_resolved()constnoexcept {
60+
boolcache_resolved()constnoexcept {
5661
return cache_resolved_;
5762
}
5863

@@ -61,25 +66,35 @@ namespace v2 {
6166
return *this;
6267
}
6368

64-
constexprbooluse_proxy()constnoexcept {
69+
booluse_proxy()constnoexcept {
6570
return use_proxy_;
6671
}
6772

68-
client_options &timeout(std::uint64_t timeout)noexcept {
73+
client_options &timeout(std::chrono::milliseconds timeout)noexcept {
6974
timeout_ = timeout;
7075
return *this;
7176
}
7277

73-
constexprstd::uint64_ttimeout()constnoexcept {
78+
std::chrono::millisecondstimeout()constnoexcept {
7479
return timeout_;
7580
}
7681

82+
std::vector<std::string>openssl_certificate_paths()const {
83+
return openssl_certificate_paths_;
84+
}
85+
86+
std::vector<std::string>openssl_verify_paths()const {
87+
return openssl_verify_paths_;
88+
}
89+
7790
private:
7891

7992
bool follow_redirects_;
8093
bool cache_resolved_;
8194
bool use_proxy_;
82-
std::uint64_t timeout_;
95+
std::chrono::milliseconds timeout_;
96+
std::vector<std::string> openssl_certificate_paths_;
97+
std::vector<std::string> openssl_verify_paths_;
8398

8499
};
85100
}// namespace v2

‎http/test/client/v2/client_options_test.cpp‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ TEST(client_options_test, default_options_use_proxy) {
2121
ASSERT_FALSE(opts.use_proxy());
2222
}
2323

24+
TEST(client_options, default_options_openssl_certificate_paths) {
25+
network::http::v2::client_options opts;
26+
ASSERT_TRUE(opts.openssl_certificate_paths().empty());
27+
}
28+
29+
TEST(client_options, default_options_openssl_verify_paths) {
30+
network::http::v2::client_options opts;
31+
ASSERT_TRUE(opts.openssl_verify_paths().empty());
32+
}
33+
2434
TEST(client_options_test, set_option_follow_redirects) {
2535
network::http::v2::client_options opts;
2636
opts.follow_redirects(true);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp