• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jbaldwin / liblifthttp / f029c96a1780445bdaebfea044d5167e06b271c7-PR-163

02 May 2025 10:27AM UTC coverage: 88.018%. First build
f029c96a1780445bdaebfea044d5167e06b271c7-PR-163

Pull #163

github

web-flow
Merge a5756b0a1 into ba15ed4fd
Pull Request #163: added network (CURLOPT_ERRORBUFFER) error message to response

9 of 13 new or added lines in 3 files covered. (69.23%)

1168 of 1327 relevant lines covered (88.02%)

15457.32 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

20.0
/src/response.cpp
1
#include "lift/response.hpp"
2
#include "lift/const.hpp"
3

4
#include <functional>
5

6
namespace lift
7
{
8
response::response()
35,455✔
9
{
10
    m_network_error_message[0] = '\0';
35,451✔
11
    m_headers.reserve(header_default_count);
35,451✔
12
}
35,454✔
13

14
auto response::header(std::string_view name) const -> std::optional<std::reference_wrapper<const lift::header>>
×
15
{
16
    for (const auto& header : m_headers)
×
17
    {
18
        if (header.name() == name)
×
19
        {
20
            return std::optional{std::cref(header)};
×
21
        }
22
    }
23

24
    return std::nullopt;
×
25
}
26

NEW
27
std::string_view response::network_error_message() const
×
28
{
NEW
29
    return std::string_view(
×
NEW
30
        m_network_error_message[0] != '\0' ? m_network_error_message : curl_easy_strerror(m_curl_code));
×
31
}
32

33
auto operator<<(std::ostream& os, const response& r) -> std::ostream&
×
34
{
35
    os << lift::http::to_string(r.m_version) << ' ' << lift::http::to_string(r.m_status_code) << "\r\n";
×
36
    for (const auto& header : r.m_headers)
×
37
    {
38
        os << header << "\r\n";
×
39
    }
40
    os << "\r\n";
×
41
    if (!r.m_data.empty())
×
42
    {
43
        os << std::string_view{r.m_data.data(), r.m_data.size()};
×
44
    }
45

46
    return os;
×
47
}
48

49
} // namespace lift
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc