Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/main/java/in/dragonbra/javasteam/steam/cdn/Client.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ class Client(steamClient: SteamClient) : Closeable {

private val logger: Logger = LogManager.getLogger(Client::class.java)

private fun buildCommand(
@JvmStatic
fun buildCommand(
server: Server,
command: String,
query: String? = null,
Expand Down
17 changes: 17 additions & 0 deletions src/test/java/in/dragonbra/javasteam/steam/cdn/CDNClientTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,21 @@ public void testPrivateIPv6Addresses(String ipAddress, boolean expected) throws
boolean result = ClientLancache.isPrivateAddress(address);
Assertions.assertEquals(expected, result);
}

@ParameterizedTest
@CsvSource({
"token=abc, token, ", // normal, no change
"?token=abc, token, ?token", // leading ? stripped
"??token=abc, token, ??token", // multiple leading ? stripped
"?token=abc&foo=bar, token, ?token", // leading ? with multiple params
})
public void buildCommandStripsLeadingQuestionMarkFromQueryString(String query, String expectedKey, String unexpectedKey) {
var server = Server.fromHostAndPort("localhost", 80);
HttpUrl url = Client.buildCommand(server, "depot/731/manifest", query, null);

Assertions.assertNotNull(url.queryParameter(expectedKey));
if (unexpectedKey != null) {
Assertions.assertNull(url.queryParameter(unexpectedKey));
}
}
}
Loading