Skip to content

Commit 6c459de

Browse files
Avoid boost::optional::has_value()
There are checks on old boost versions without this method Relates-To: MINOR Signed-off-by: Rustam Gamidov <ext-rustam.gamidov@here.com>
1 parent 54203ce commit 6c459de

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

olp-cpp-sdk-authentication/src/AuthenticationClientImpl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ client::HttpResponse CallApi(const client::OlpClient& client,
156156
}
157157

158158
std::string DeduceContentType(const SignInProperties& properties) {
159-
if (properties.custom_body.has_value()) {
159+
if (properties.custom_body) {
160160
return "";
161161
}
162162
return AuthenticationClientImpl::kApplicationJson;
@@ -328,7 +328,7 @@ client::CancellationToken AuthenticationClientImpl::SignInClient(
328328
const auto credentials_endpoint = credentials.GetEndpointUrl();
329329
const auto maybe_host_and_rest =
330330
olp::utils::Url::ParseHostAndRest(credentials_endpoint);
331-
if (maybe_host_and_rest.has_value()) {
331+
if (maybe_host_and_rest) {
332332
const auto& host_and_rest = maybe_host_and_rest.value();
333333
olp_client_host = host_and_rest.first;
334334
endpoint = host_and_rest.second;
@@ -814,7 +814,7 @@ client::CancellationToken AuthenticationClientImpl::GetMyAccount(
814814

815815
client::OlpClient::RequestBodyType AuthenticationClientImpl::GenerateClientBody(
816816
const SignInProperties& properties) {
817-
if (properties.custom_body.has_value()) {
817+
if (properties.custom_body) {
818818
const auto& content = properties.custom_body.value();
819819
return std::make_shared<RequestBodyData>(content.data(),
820820
content.data() + content.size());

olp-cpp-sdk-core/tests/utils/UrlTest.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ using UrlTest = testing::Test;
3030
TEST(UrlTest, ParseHostAndRest) {
3131
{
3232
SCOPED_TRACE("Bad Url");
33-
EXPECT_FALSE(olp::utils::Url::ParseHostAndRest("bad url").has_value());
33+
EXPECT_FALSE(olp::utils::Url::ParseHostAndRest("bad url"));
3434
}
3535

3636
{
3737
SCOPED_TRACE("Good Url");
3838
const auto result = olp::utils::Url::ParseHostAndRest(
3939
"https://account.api.here.com/oauth2/token");
40-
ASSERT_TRUE(result.has_value());
40+
ASSERT_TRUE(result);
4141
const auto& host = result.value().first;
4242
const auto& rest = result.value().second;
4343
EXPECT_EQ(host, "https://account.api.here.com");
@@ -48,7 +48,7 @@ TEST(UrlTest, ParseHostAndRest) {
4848
SCOPED_TRACE("Good Url with port");
4949
const auto result = olp::utils::Url::ParseHostAndRest(
5050
"https://account.api.here.com:8080/oauth2/token");
51-
ASSERT_TRUE(result.has_value());
51+
ASSERT_TRUE(result);
5252
const auto& host = result.value().first;
5353
const auto& rest = result.value().second;
5454
EXPECT_EQ(host, "https://account.api.here.com:8080");

0 commit comments

Comments
 (0)