diff --git a/src/oatpp/web/protocol/http/outgoing/BufferBody.cpp b/src/oatpp/web/protocol/http/outgoing/BufferBody.cpp index c230bd88..274fb8b5 100644 --- a/src/oatpp/web/protocol/http/outgoing/BufferBody.cpp +++ b/src/oatpp/web/protocol/http/outgoing/BufferBody.cpp @@ -26,23 +26,24 @@ namespace oatpp { namespace web { namespace protocol { namespace http { namespace outgoing { -BufferBody::BufferBody(const oatpp::String& buffer, const data::share::StringKeyLabel& contentType) +BufferBody::BufferBody(const oatpp::String &buffer, const data::share::StringKeyLabel &contentType) : m_buffer(buffer) , m_contentType(contentType) , m_inlineData(m_buffer->getData(), m_buffer->getSize()) {} -std::shared_ptr BufferBody::createShared(const oatpp::String& buffer, const data::share::StringKeyLabel& contentType) { +std::shared_ptr BufferBody::createShared(const oatpp::String &buffer, + const data::share::StringKeyLabel &contentType) { return Shared_Http_Outgoing_BufferBody_Pool::allocateShared(buffer, contentType); } -v_io_size BufferBody::read(void *buffer, v_buff_size count, async::Action& action) { +v_io_size BufferBody::read(void *buffer, v_buff_size count, async::Action &action) { (void) action; v_buff_size desiredToRead = m_inlineData.bytesLeft; - if(desiredToRead > 0) { + if (desiredToRead > 0) { if (desiredToRead > count) { desiredToRead = count; @@ -59,9 +60,9 @@ v_io_size BufferBody::read(void *buffer, v_buff_size count, async::Action& actio } -void BufferBody::declareHeaders(Headers& headers) { - if(m_contentType) { - headers.put(Header::CONTENT_TYPE, m_contentType); +void BufferBody::declareHeaders(Headers &headers) { + if (m_contentType) { + headers.putIfNotExists(Header::CONTENT_TYPE, m_contentType); } }