Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be const #58

Merged
merged 3 commits into from
Jan 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/dracon/plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#pragma once

#include <cstdint>
#include <functional>
#include <string>

Expand Down
5 changes: 3 additions & 2 deletions include/dracon/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <condition_variable>
#include <cstring>
#include <list>
#include <stdexcept>
#include <string>
#include <string_view>
#include <thread>
Expand Down Expand Up @@ -61,7 +62,7 @@ class SpinLock
m_lock.clear(std::memory_order_release);
}

inline bool tryLock()
inline bool tryLock() noexcept
{
return !m_lock.test_and_set(std::memory_order_acquire);
}
Expand Down Expand Up @@ -192,7 +193,7 @@ class LruCache
return it->second->second;
}

inline bool exists(const K &key)
inline bool exists(const K &key) const
{
return m_cacheHash.find(key) != m_cacheHash.end();
}
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/test/test_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/

#include <dracon/http.h>
#include <dracon/logging.h>
#include <dracon/plugin.h>
#include <dracon/restful.h>
#include <dracon/logging.h>
#include <dracon/thread_worker.h>

#include <cassert>
Expand Down
5 changes: 5 additions & 0 deletions tests/common/EasyCurl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ EasyCurl::Response EasyCurl::request(const std::string &method, std::string uplo
setOptions(CURLOPT_READFUNCTION, &read_callback);
setOptions(CURLOPT_UPLOAD, 1L);
setOptions(CURLOPT_INFILESIZE_LARGE, curl_off_t(upload.size()));
} else {
setOptions(CURLOPT_READDATA, nullptr);
setOptions(CURLOPT_READFUNCTION, nullptr);
setOptions(CURLOPT_UPLOAD, 0L);
setOptions(CURLOPT_INFILESIZE_LARGE, 0);
}

auto err = curl_easy_perform(m_curl);
Expand Down
6 changes: 5 additions & 1 deletion tests/server_tests/ResponseStatusErrorExceptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ TEST_P(ResponseStatusError, expectations100)
Getodac::Test::EasyCurl curl;
EXPECT_NO_THROW(curl.setUrl(url(GetParam(), "/testExpectation")));
curl.ingnoreInvalidSslCertificate();
curl.setHeaders({{"X-Continue", "100"}});
curl.setHeaders({
{"Expect", "100-continue"},
{"X-Continue", "100"}
});
auto reply = curl.post("some data");
EXPECT_EQ(reply.status, "200");
EXPECT_EQ(reply.body.size(), 0);
Expand All @@ -89,6 +92,7 @@ TEST_P(ResponseStatusError, expectations417)
Getodac::Test::EasyCurl curl;
EXPECT_NO_THROW(curl.setUrl(url(GetParam(), "/testExpectation")));
curl.ingnoreInvalidSslCertificate();
curl.setHeaders({{"Expect", "100-continue"}});
auto reply = curl.post("some data");
EXPECT_EQ(reply.status, "417");
EXPECT_EQ(reply.body.size(), 0);
Expand Down
Loading