diff --git a/webserv/http/HttpResponse.cpp b/webserv/http/HttpResponse.cpp index 617b27a..7da5d58 100644 --- a/webserv/http/HttpResponse.cpp +++ b/webserv/http/HttpResponse.cpp @@ -89,7 +89,7 @@ std::string HttpResponse::getDateHeader() const return "Date: " + std::string(buffer) + "\r\n"; } -std::vector HttpResponse::toBytes() const +std::vector HttpResponse::toBytes(long offset) const { std::string headerStr; std::string reason; @@ -107,5 +107,5 @@ std::vector HttpResponse::toBytes() const std::vector responseData(headerStr.begin(), headerStr.end()); responseData.insert(responseData.end(), body_.begin(), body_.end()); - return responseData; + return {responseData.begin() + offset, responseData.end()}; } \ No newline at end of file diff --git a/webserv/http/HttpResponse.hpp b/webserv/http/HttpResponse.hpp index ebcabca..58c3fa6 100644 --- a/webserv/http/HttpResponse.hpp +++ b/webserv/http/HttpResponse.hpp @@ -39,7 +39,7 @@ class HttpResponse [[nodiscard]] const HttpHeaders &getHeaders() const noexcept; - [[nodiscard]] std::vector toBytes() const; + [[nodiscard]] std::vector toBytes(long offset = 0) const; private: [[nodiscard]] std::string getStatusLine() const;