GCC Code Coverage Report


Directory: ./
File: libs/http/src/server/route_handler.cpp
Date: 2026-01-20 00:11:35
Exec Total Coverage
Lines: 3 14 21.4%
Functions: 1 3 33.3%
Branches: 0 7 0.0%

Line Branch Exec Source
1 //
2 // Copyright (c) 2025 Vinnie Falco (vinnie dot falco at gmail dot com)
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //
7 // Official repository: https://github.com/cppalliance/http
8 //
9
10 #include <boost/http/server/route_handler.hpp>
11 #include <boost/http/string_body.hpp>
12 #include <boost/capy/ex/run_sync.hpp>
13
14 namespace boost {
15 namespace http {
16
17 1 route_params::
18 1 ~route_params()
19 {
20 1 }
21
22 route_params&
23 route_params::
24 status(
25 http::status code)
26 {
27 res.set_start_line(code, res.version());
28 return *this;
29 }
30
31 route_params&
32 route_params::
33 set_body(std::string s)
34 {
35 if(! res.exists(http::field::content_type))
36 {
37 // VFALCO TODO detect Content-Type
38 res.set(http::field::content_type,
39 "text/plain; charset=UTF-8");
40 }
41
42 if(! res.exists(field::content_length))
43 {
44 res.set_payload_size(s.size());
45 }
46
47 serializer.start(res,
48 http::string_body(std::string(s)));
49
50 return *this;
51 }
52
53 } // http
54 } // boost
55