mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-10-19 11:19:36 +00:00
Fix redirect for mounted folders (#2628)
A directory request without a trailing slash was redirected to the path relative to the mount point, so /mount/dir under a mount at /mount sent Location: //dir/ instead of /mount/dir/. Redirect to the request path with the slash appended.
This commit is contained in:
1 parent
c419c904da
commit
924b5cecf0
2 files changed
+8
-1
No files matched your search
@@ -6660,6 +6660,13 @@ TEST_F(ServerTest, GetMethodOutOfBaseDirMountWithBackslash) {
|
||||
EXPECT_EQ(StatusCode::NotFound_404, res->status);
|
||||
}
|
||||
|
||||
TEST_F(ServerTest, GetMethodDirMountWithoutTrailingSlash) {
|
||||
auto res = cli_.Get("/mount/dir");
|
||||
ASSERT_TRUE(res) << "Error: " << to_string(res.error());
|
||||
EXPECT_EQ(StatusCode::MovedPermanently_301, res->status);
|
||||
EXPECT_EQ("/mount/dir/", res->get_header_value("Location"));
|
||||
}
|
||||
|
||||
TEST_F(ServerTest, PostMethod303) {
|
||||
auto res = cli_.Post("/1", "body", "text/plain");
|
||||
ASSERT_TRUE(res) << "Error: " << to_string(res.error());
|
||||
|
||||
Reference in new issue
Block a user