LCOV - code coverage report
Current view: top level - libs/http_proto/src/server - route_handler.cpp (source / functions) Coverage Total Hit
Test: coverage_filtered.info Lines: 15.0 % 20 3
Test Date: 2025-12-05 19:49:25 Functions: 16.7 % 6 1

            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/http_proto
       8              : //
       9              : 
      10              : #include <boost/http_proto/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 http_proto {
      17              : 
      18            1 : route_params::
      19            1 : ~route_params()
      20              : {
      21            1 : }
      22              : 
      23            0 : route_params::task::
      24              : ~task() = default;
      25              : 
      26              : route_params&
      27            0 : route_params::
      28              : status(
      29              :     http_proto::status code)
      30              : {
      31            0 :     res.set_start_line(code, res.version());
      32            0 :     return *this;
      33              : }
      34              : 
      35              : route_params&
      36            0 : route_params::
      37              : set_body(std::string s)
      38              : {
      39            0 :     if(! res.exists(http_proto::field::content_type))
      40              :     {
      41              :         // VFALCO TODO detect Content-Type
      42            0 :         res.set(http_proto::field::content_type,
      43              :             "text/plain; charset=UTF-8");
      44              :     }
      45              : 
      46            0 :     if(! res.exists(field::content_length))
      47              :     {
      48            0 :         res.set_payload_size(s.size());
      49              :     }
      50              : 
      51            0 :     serializer.start(res,
      52            0 :         http_proto::string_body(std::string(s)));
      53              : 
      54            0 :     return *this;
      55              : }
      56              : 
      57              : void
      58            0 : route_params::
      59              : do_post()
      60              : {
      61            0 :     BOOST_ASSERT(task_);
      62              :     // invoke until task resumes
      63              :     for(;;)
      64            0 :         if(task_->invoke())
      65            0 :             break;
      66            0 : }
      67              : 
      68              : } // http_proto
      69              : } // boost
        

Generated by: LCOV version 2.1