2022-06-30 01:35:02 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
// system includes
|
|
|
|
|
#include <string_view>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <utility>
|
|
|
|
|
#include <vector>
|
|
|
|
|
#include <system_error>
|
|
|
|
|
|
|
|
|
|
// 3rdparty lib includes
|
2022-07-05 13:07:36 +02:00
|
|
|
#include <asio_web/responsehandler.h>
|
2022-06-30 01:35:02 +02:00
|
|
|
|
|
|
|
|
// forward declarations
|
|
|
|
|
class ClientConnection;
|
|
|
|
|
|
2022-06-30 03:41:33 +02:00
|
|
|
class DebugResponseHandler final : public ResponseHandler
|
2022-06-30 01:35:02 +02:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
DebugResponseHandler(ClientConnection &clientConnection, std::string_view method, std::string_view path, std::string_view protocol);
|
2022-06-30 03:41:33 +02:00
|
|
|
~DebugResponseHandler() final;
|
2022-06-30 01:35:02 +02:00
|
|
|
|
|
|
|
|
void requestHeaderReceived(std::string_view key, std::string_view value) final;
|
2022-06-30 03:41:33 +02:00
|
|
|
void requestBodyReceived(std::string_view body) final;
|
2022-06-30 01:35:02 +02:00
|
|
|
void sendResponse() final;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void written(std::error_code ec, std::size_t length);
|
|
|
|
|
|
|
|
|
|
ClientConnection &m_clientConnection;
|
|
|
|
|
std::string m_method;
|
|
|
|
|
std::string m_path;
|
|
|
|
|
std::string m_protocol;
|
|
|
|
|
|
|
|
|
|
std::vector<std::pair<std::string, std::string>> m_requestHeaders;
|
|
|
|
|
|
2022-06-30 03:41:33 +02:00
|
|
|
std::string m_requestBody;
|
|
|
|
|
|
2022-06-30 01:35:02 +02:00
|
|
|
std::string m_response;
|
|
|
|
|
};
|