Skip to content

Commit 2c671c2

Browse files
committed
Remove custom absolute url checks (see #10)
1 parent ce1f1b2 commit 2c671c2

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/main/java/jodd/http/HttpResponse.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,10 @@ public String location() {
9797
return null;
9898
}
9999

100-
if (!HttpUtil.isAbsoluteUrl(location)) {
101-
try {
102-
location = new URL(new URL(httpRequest.url()), location).toString();
103-
} catch (MalformedURLException e) {
104-
throw new HttpException("Invalid location: " + location, e);
105-
}
100+
try {
101+
location = new URL(new URL(httpRequest.url()), location).toString();
102+
} catch (MalformedURLException e) {
103+
throw new HttpException("Invalid location: " + location, e);
106104
}
107105

108106
return location;

src/test/java/jodd/http/HttpUtilTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,12 @@ void testAbsoluteUrls() {
176176
}
177177

178178
@Test
179-
void testAbsoluteUrls2() throws MalformedURLException {
179+
void testAbsoluteUrls2() {
180180
{
181181
HttpRequest request = HttpRequest.get("https://jodd.org/hello/world");
182-
String location = "https://jodd.org";
182+
String location = "https://jodd.org/foo";
183183

184-
assertEquals("https://jodd.org", locationOf(request, location));
184+
assertEquals("https://jodd.org/foo", locationOf(request, location));
185185
}
186186
{
187187
HttpRequest request = HttpRequest.get("https://jodd.org/hello/world");

0 commit comments

Comments
 (0)