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

Generated by: LCOV version 2.1