http_response.hpp (f23b729676559f539790580930b1ff3b0c05805b) | http_response.hpp (81ce609e30274435b4f8c3fc65340c6b6b153b0c) |
---|---|
1#pragma once 2#include "http_request.hpp" 3#include "logging.hpp" 4#include "nlohmann/json.hpp" 5 6#include <boost/beast/http/message.hpp> 7 8#include <string> --- 88 unchanged lines hidden (view full) --- 97 void clear() 98 { 99 BMCWEB_LOG_DEBUG << this << " Clearing response containers"; 100 stringResponse.emplace(response_type{}); 101 jsonValue.clear(); 102 completed = false; 103 } 104 | 1#pragma once 2#include "http_request.hpp" 3#include "logging.hpp" 4#include "nlohmann/json.hpp" 5 6#include <boost/beast/http/message.hpp> 7 8#include <string> --- 88 unchanged lines hidden (view full) --- 97 void clear() 98 { 99 BMCWEB_LOG_DEBUG << this << " Clearing response containers"; 100 stringResponse.emplace(response_type{}); 101 jsonValue.clear(); 102 completed = false; 103 } 104 |
105 void write(std::string_view body_part) | 105 void write(std::string_view bodyPart) |
106 { | 106 { |
107 stringResponse->body() += std::string(body_part); | 107 stringResponse->body() += std::string(bodyPart); |
108 } 109 110 void end() 111 { 112 if (completed) 113 { 114 BMCWEB_LOG_ERROR << "Response was ended twice"; 115 return; 116 } 117 completed = true; 118 BMCWEB_LOG_DEBUG << "calling completion handler"; 119 if (completeRequestHandler) 120 { 121 BMCWEB_LOG_DEBUG << "completion handler was valid"; 122 completeRequestHandler(); 123 } 124 } 125 | 108 } 109 110 void end() 111 { 112 if (completed) 113 { 114 BMCWEB_LOG_ERROR << "Response was ended twice"; 115 return; 116 } 117 completed = true; 118 BMCWEB_LOG_DEBUG << "calling completion handler"; 119 if (completeRequestHandler) 120 { 121 BMCWEB_LOG_DEBUG << "completion handler was valid"; 122 completeRequestHandler(); 123 } 124 } 125 |
126 void end(std::string_view body_part) | 126 void end(std::string_view bodyPart) |
127 { | 127 { |
128 write(body_part); | 128 write(bodyPart); |
129 end(); 130 } 131 132 bool isAlive() 133 { 134 return isAliveHelper && isAliveHelper(); 135 } 136 --- 12 unchanged lines hidden --- | 129 end(); 130 } 131 132 bool isAlive() 133 { 134 return isAliveHelper && isAliveHelper(); 135 } 136 --- 12 unchanged lines hidden --- |