diff --git a/frameworks/js/builtin/http_request/response_data.cpp b/frameworks/js/builtin/http_request/response_data.cpp index 4b48243102f38dc14e2b40a40bc91f4f09c87a3e..ff49d44c01df44788ceb156429606640d9e988ac 100644 --- a/frameworks/js/builtin/http_request/response_data.cpp +++ b/frameworks/js/builtin/http_request/response_data.cpp @@ -44,13 +44,12 @@ void ResponseData::ParseHeaders(const std::string &headersStr) if (header.empty()) { continue; } - size_t posColon = header.find(HttpConstant::HTTP_HEADER_SEPARATOR); - if (posColon == std::string::npos) { + size_t index = header.find(HttpConstant::HTTP_HEADER_SEPARATOR); + if (index == std::string::npos) { statusLine = Strip(header); continue; } - std::vector temp = Split(header, HttpConstant::HTTP_HEADER_SEPARATOR); - headers[Strip(temp[0])] = Strip(temp[1]); + headers[Strip(header.substr(0, index))] = Strip(header.substr(index + 1)); } }