#pragma once #include #include "envoy/http/header_map.h" #include "envoy/http/message.h" #include "common/buffer/buffer_impl.h" #include "common/common/non_copyable.h" #include "common/http/header_map_impl.h" namespace Envoy { namespace Http { /** * Implementation of Http::Message. This implementation does not support streaming. */ template class MessageImpl : public Message { public: MessageImpl() : headers_(HeadersImplType::create()) {} MessageImpl(std::unique_ptr&& headers) : headers_(std::move(headers)) {} // Http::Message HeadersInterfaceType& headers() override { return *headers_; } Buffer::Instance& body() override { return body_; } TrailersInterfaceType* trailers() override { return trailers_.get(); } void trailers(std::unique_ptr&& trailers) override { trailers_ = std::move(trailers); } std::string bodyAsString() const override { return body_.toString(); } private: std::unique_ptr headers_; Buffer::OwnedImpl body_; std::unique_ptr trailers_; }; using RequestMessageImpl = MessageImpl; using ResponseMessageImpl = MessageImpl; } // namespace Http } // namespace Envoy