Skip to content

Commit ce15fd4

Browse files
committed
wss conf string support a rest token + more tests
1 parent da21b2e commit ce15fd4

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

core/src/main/java/io/questdb/client/Sender.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,9 +1692,7 @@ private LineSenderBuilder fromConfig(CharSequence configurationString) {
16921692
}
16931693
} else if (Chars.equals("token", sink)) {
16941694
pos = getValue(configurationString, pos, sink, "token");
1695-
if (protocol == PROTOCOL_WEBSOCKET) {
1696-
throw new LineSenderException("token is not supported for WebSocket protocol");
1697-
} else if (protocol == PROTOCOL_TCP) {
1695+
if (protocol == PROTOCOL_TCP) {
16981696
tcpToken = sink.toString();
16991697
// will configure later, we need to know a keyId first
17001698
} else if (protocol == PROTOCOL_UDP) {

core/src/test/java/io/questdb/client/test/cutlass/qwp/client/LineSenderBuilderWebSocketTest.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,8 +639,8 @@ public void testWsConfigString_uppercaseNotSupported() {
639639
@Test
640640
public void testWsConfigString_withToken() throws Exception {
641641
assertMemoryLeak(() -> {
642-
int port = findUnusedPort();
643-
assertBadConfig("ws::addr=localhost:" + port + ";token=mytoken;", "token is not supported");
642+
Sender.LineSenderBuilder builder = Sender.builder("ws::addr=localhost:9000;token=mytoken;");
643+
Assert.assertNotNull(builder);
644644
});
645645
}
646646

@@ -659,6 +659,12 @@ public void testWssConfigString() throws Exception {
659659
});
660660
}
661661

662+
@Test
663+
public void testWssConfigString_withToken() {
664+
Sender.LineSenderBuilder builder = Sender.builder("wss::addr=localhost:9000;tls_verify=unsafe_off;token=mytoken;");
665+
Assert.assertNotNull(builder);
666+
}
667+
662668
@Test
663669
public void testWssConfigString_uppercaseNotSupported() {
664670
assertBadConfig("WSS::addr=localhost:9000;", "invalid schema");

0 commit comments

Comments
 (0)