-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Description
Description
I use boost/ut framework for unit testing, I create test suites as static objects (recommended by framework authors):
suite<"client"> clientTest= []{
"login"_test = [] {
cpr::Response getResp = cpr::Get(cpr::Url{"..."});
....
};
}
It result in runtime error:
It looks like static initialization order fiasco
P.S. thanks for your work, it is awsome
Example/How to Reproduce
- Create a
cpr::Response getResp = cpr::Get(cpr::Url{"..."});with static storage duration
#include <cpr/cpr.h>
cpr::Response getResp = cpr::Get(cpr::Url{"https://example-website.com"});
- See error
Possible Fix
Please, consider replacing static unordered_map with function like this:
ErrorCode curl_error_to_error_code(std::int32_t curl_error) {
switch (curl_error) {
case CURLE_OK:
return ErrorCode::OK;
// and so on ...
default:
return ErrorCode::TOO_LARGE;
}
}
Where did you get it from?
GitHub (branch e.g. master)
Additional Context/Your Environment
- OS: Windows 11
- Version: 1.12.0
Reactions are currently unavailable