2022-06-30 01:35:02 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
// system includes
|
|
|
|
|
#include <string_view>
|
|
|
|
|
#include <string>
|
|
|
|
|
#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 ErrorResponseHandler final : public ResponseHandler
|
2022-06-30 01:35:02 +02:00
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ErrorResponseHandler(ClientConnection &clientConnection, std::string_view path);
|
2022-06-30 03:41:33 +02:00
|
|
|
~ErrorResponseHandler() 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_path;
|
|
|
|
|
|
|
|
|
|
std::string m_response;
|
|
|
|
|
};
|