Skip to content

Commit f54cfe9

Browse files
committed
Tests
1 parent 8ef3774 commit f54cfe9

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

java-http.ipr

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<component name="InspectionProjectProfileManager">
1313
<profile version="1.0">
1414
<option name="myName" value="Project Default" />
15+
<inspection_tool class="HttpUrlsUsage" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
1516
<inspection_tool class="SizeReplaceableByIsEmpty" enabled="true" level="WARNING" enabled_by_default="true">
1617
<option name="ignoredTypes">
1718
<set>

src/test/java/io/fusionauth/http/HTTPRequestTest.java

+11-5
Original file line numberDiff line numberDiff line change
@@ -71,25 +71,31 @@ public void getBaseURL() {
7171
"X-Forwarded-Port", "443",
7272
"X-Forwarded-Proto", "https");
7373

74-
// Use case 4: Missing X-Forwarded-Proto header, cannot infer 443
74+
// Use case 4: Set port from the X-Forwarded-Port header, non-standard
75+
assertBaseURL("https://acme.com:8192",
76+
"X-Forwarded-Host", "acme.com",
77+
"X-Forwarded-Port", "8192",
78+
"X-Forwarded-Proto", "https");
79+
80+
// Use case 5: Missing X-Forwarded-Proto header, cannot infer 443
7581
assertBaseURL("http://acme.com:8080",
7682
"X-Forwarded-Host", "acme.com");
7783

78-
// Use case 5: Malformed X-Forwarded-Host header, so we'll ignore the port on the -Host header.
84+
// Use case 6: Malformed X-Forwarded-Host header, so we'll ignore the port on the -Host header.
7985
assertBaseURL("https://acme.com:8080",
8086
"X-Forwarded-Host", "acme.com:##",
8187
"X-Forwarded-Proto", "https");
8288

83-
// Use case 6: Missing X-Forwarded-Host
89+
// Use case 7: Missing X-Forwarded-Host
8490
assertBaseURL("https://localhost:8080",
8591
"X-Forwarded-Proto", "https");
8692

87-
// Use case 7: http and port 80
93+
// Use case 8: http and port 80
8894
assertBaseURL("https://localhost",
8995
request -> request.setPort(80),
9096
"X-Forwarded-Proto", "https");
9197

92-
// Use case 8: https and port 80
98+
// Use case 9: https and port 80
9399
assertBaseURL("http://localhost",
94100
request -> {
95101
request.setPort(80);

0 commit comments

Comments
 (0)