1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:37:37 +00:00

AK: Use base URL when the specified URL is empty

This commit is contained in:
Thiago Henrique Hupner 2022-12-27 16:17:30 -03:00 committed by Andrew Kaster
parent 96d3d3b0fe
commit 401bc13776
2 changed files with 10 additions and 1 deletions

View file

@ -9,6 +9,7 @@
#include <AK/Base64.h>
#include <AK/URL.h>
#include <AK/URLParser.h>
TEST_CASE(construct)
{
@ -406,3 +407,11 @@ TEST_CASE(complete_file_url_with_base)
EXPECT(sub_url.is_valid());
EXPECT_EQ(sub_url.path(), "/home/js/app.js");
}
TEST_CASE(empty_url_with_base_url)
{
URL base_url { "https://foo.com/"sv };
URL parsed_url = URLParser::parse(""sv, &base_url);
EXPECT_EQ(parsed_url.is_valid(), true);
EXPECT(base_url.equals(parsed_url));
}