Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebSockets Next client: support string params for connector.baseUri() #42196

Merged
merged 1 commit into from
Jul 29, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class BasicConnectorTest {
@Test
void testClient() throws InterruptedException {

assertThrows(NullPointerException.class, () -> connector.baseUri(null));
assertThrows(IllegalArgumentException.class, () -> connector.baseUri("foo\\"));
assertThrows(NullPointerException.class, () -> connector.path(null));
assertThrows(NullPointerException.class, () -> connector.addHeader(null, "foo"));
assertThrows(NullPointerException.class, () -> connector.addHeader("foo", null));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class ClientAutoPingIntervalTest {

@Test
public void testPingPong() throws InterruptedException, ExecutionException {
connector.baseUri(uri).connectAndAwait();
connector.baseUri(uri.toString()).connectAndAwait();
// Ping messages are sent automatically
assertTrue(ClientEndpoint.PONG.await(5, TimeUnit.SECONDS));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ static BasicWebSocketConnector create() {
*/
BasicWebSocketConnector baseUri(URI uri);

/**
* Set the base URI.
*
* @param baseUri
* @return self
*/
default BasicWebSocketConnector baseUri(String baseUri) {
return baseUri(URI.create(baseUri));
}

/**
* Set the path that should be appended to the path of the URI set by {@link #baseUri(URI)}.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ public interface WebSocketConnector<CLIENT> {
*/
WebSocketConnector<CLIENT> baseUri(URI baseUri);

/**
* Set the base URI.
*
* @param baseUri
* @return self
*/
default WebSocketConnector<CLIENT> baseUri(String baseUri) {
return baseUri(URI.create(baseUri));
}

/**
* Set the path param.
* <p>
Expand Down