Skip to content

Commit 6aaa018

Browse files
committed
Fix separator character
1 parent 5fb093a commit 6aaa018

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/http_utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ std::string http_utils::standardize_url(const std::string& url)
225225
{
226226
std::string n_url = url;
227227

228-
std::string::iterator new_end = std::unique(n_url.begin(), n_url.end(), [](char a, char b) { return (a == b) && (a == ' '); });
228+
std::string::iterator new_end = std::unique(n_url.begin(), n_url.end(), [](char a, char b) { return (a == b) && (a == '/'); });
229229
n_url.erase(new_end, n_url.end());
230230

231231
std::string::size_type n_url_length = n_url.length();

test/unit/http_utils_test.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ LT_BEGIN_AUTO_TEST(http_utils_suite, standardize_url)
128128
url = "/abc/pqr", result = "";
129129
result = http::http_utils::standardize_url(url);
130130
LT_CHECK_EQ(result, "/abc/pqr");
131+
132+
url = "/abc//pqr", result = "";
133+
result = http::http_utils::standardize_url(url);
134+
LT_CHECK_EQ(result, "/abc/pqr");
131135
LT_END_AUTO_TEST(standardize_url)
132136

133137
LT_BEGIN_AUTO_TEST(http_utils_suite, ip_to_str)

0 commit comments

Comments
 (0)