LCOV - code coverage report
Current view: top level - libs/beast2/src/server - route_handler.cpp (source / functions) Coverage Total Hit
Test: coverage_filtered.info Lines: 0.0 % 15 0
Test Date: 2025-11-20 15:35:53 Functions: 0.0 % 3 0

            Line data    Source code
       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/beast2
       8              : //
       9              : 
      10              : #include <boost/beast2/server/route_handler.hpp>
      11              : #include <boost/http_proto/string_body.hpp>
      12              : #include <boost/assert.hpp>
      13              : #include <cstring>
      14              : 
      15              : namespace boost {
      16              : namespace beast2 {
      17              : 
      18              : route_result
      19            0 : Response::
      20              : fail(system::error_code const& ec)
      21              : {
      22            0 :     if(! ec.failed())
      23            0 :         detail::throw_invalid_argument();
      24            0 :     return ec;
      25              : }
      26              : 
      27              : Response&
      28            0 : Response::
      29              : status(
      30              :     http_proto::status code)
      31              : {
      32            0 :     message.set_start_line(code, message.version());
      33            0 :     return *this;
      34              : }
      35              : 
      36              : Response&
      37            0 : Response::
      38              : set_body(std::string s)
      39              : {
      40            0 :     if(! message.exists(http_proto::field::content_type))
      41              :     {
      42              :         // VFALCO TODO detect Content-Type
      43            0 :         message.set(http_proto::field::content_type,
      44              :             "text/plain; charset=UTF-8");
      45              :     }
      46              : 
      47            0 :     if(!message.exists(http_proto::field::content_length))
      48              :     {
      49            0 :         message.set_payload_size(s.size());
      50              :     }
      51              : 
      52            0 :     serializer.start(message,
      53            0 :         http_proto::string_body(std::string(s)));
      54              : 
      55            0 :     return *this;
      56              : }
      57              : 
      58              : } // beast2
      59              : } // boost
        

Generated by: LCOV version 2.1