Skip to content

Commit e90052d

Browse files
Update RedirectRule.java
1 parent 5fdac73 commit e90052d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/org/example/filter/redirect/RedirectRule.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ public final class RedirectRule {
1010
public RedirectRule(Pattern sourcePattern, String targetUrl, int statusCode) {
1111
this.sourcePattern = Objects.requireNonNull(sourcePattern, "sourcePattern");
1212
this.targetUrl = Objects.requireNonNull(targetUrl, "targetUrl");
13+
if (this.targetUrl.isBlank()) {
14+
throw new IllegalArgumentException("targetUrl must not be blank");
15+
}
16+
1317
if (statusCode != 301 && statusCode != 302) {
1418
throw new IllegalArgumentException("statusCode must be 301 or 302");
1519
}
@@ -32,4 +36,4 @@ public String toString() {
3236
", statusCode=" + statusCode +
3337
'}';
3438
}
35-
}
39+
}

0 commit comments

Comments
 (0)