diff --git a/src/http.cpp b/src/http.cpp
index 83b6c8652ae7e3d0ee319fe98864751470be3905..57127c890c5c3da7869dc5f09769010b6eb647cb 100644
--- a/src/http.cpp
+++ b/src/http.cpp
@@ -917,8 +917,8 @@ Request::handle_response_header(const asio::error_code& ec)
     // has content-length
     if (content_length_it != response_.headers.end())
     {
-        std::getline(is, response_.body);
         unsigned int content_length = atoi(content_length_it->second.c_str());
+        response_.body.append(conn_->read_bytes(content_length));
         // full body already in the header
         if (response_.body.size() + 1 == content_length) {
             response_.body.append("\n");
@@ -985,9 +985,9 @@ Request::handle_response_body(const asio::error_code& ec, const size_t bytes)
     // read the content-length body
     unsigned int content_length;
     if (content_length_it != response_.headers.end() and !response_.body.empty()){
-        response_.body.append(conn_->read_bytes(bytes));
         // extract the content-length
         content_length = atoi(content_length_it->second.c_str());
+        response_.body.append(conn_->read_bytes(bytes));
         // check if fully parsed
         if (response_.body.size() == content_length)
             parse_request(response_.body);