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

egorpristanskii / distributed_storage / 15521511128

08 Jun 2025 06:48PM UTC coverage: 88.204% (-2.9%) from 91.117%
15521511128

push

github

egorpristanskii
Add http codes, update code and tests, update integration tests, add lock for list all data, fix socket shutdown for session

46 of 62 branches covered (74.19%)

Branch coverage included in aggregate %.

25 of 40 new or added lines in 5 files covered. (62.5%)

1 existing line in 1 file now uncovered.

283 of 311 relevant lines covered (91.0%)

12.75 hits per line

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

0.0
/include/network/http_codes.h
1
#pragma once
2

3
#include <string>
4
#include <unordered_map>
5

6
namespace network {
7

8
enum class HTTPCode : int {
9
    OK = 200,
10
    Created = 201,
11
    Accepted = 202,
12
    NoContent = 204,
13

14
    MovedPermanently = 301,
15
    Found = 302,
16
    NotModified = 304,
17

18
    BadRequest = 400,
19
    Unauthorized = 401,
20
    Forbidden = 403,
21
    NotFound = 404,
22
    MethodNotAllowed = 405,
23
    Conflict = 409,
24

25
    InternalServerError = 500,
26
    NotImplemented = 501,
27
    BadGateway = 502,
28
    ServiceUnavailable = 503
29
};
30

31
const std::unordered_map<HTTPCode, std::string> kHTTPCodeToString{
32
    {HTTPCode::OK, "200 OK"},
33
    {HTTPCode::Created, "201 Created"},
34
    {HTTPCode::Accepted, "202 Accepted"},
35
    {HTTPCode::NoContent, "204 No Content"},
36
    {HTTPCode::MovedPermanently, "301 Moved Permanently"},
37
    {HTTPCode::Found, "302 Found"},
38
    {HTTPCode::NotModified, "304 Not Modified"},
39
    {HTTPCode::BadRequest, "400 Bad Request"},
40
    {HTTPCode::Unauthorized, "401 Unauthorized"},
41
    {HTTPCode::Forbidden, "403 Forbidden"},
42
    {HTTPCode::NotFound, "404 Not Found"},
43
    {HTTPCode::MethodNotAllowed, "405 Method Not Allowed"},
44
    {HTTPCode::Conflict, "409 Conflict"},
45
    {HTTPCode::InternalServerError, "500 Internal Server Error"},
46
    {HTTPCode::NotImplemented, "501 Not Implemented"},
47
    {HTTPCode::BadGateway, "502 Bad Gateway"},
48
    {HTTPCode::ServiceUnavailable, "503 Service Unavailable"}};
49

NEW
50
inline std::string to_string(HTTPCode code) {
×
NEW
51
    auto it = kHTTPCodeToString.find(code);
×
NEW
52
    return it != kHTTPCodeToString.end() ? it->second : "Unknown";
×
NEW
53
}
×
54

NEW
55
inline int to_int(HTTPCode code) {
×
NEW
56
    return static_cast<int>(code);
×
NEW
57
}
×
58
}  // namespace network
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

© 2026 Coveralls, Inc