Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
test(sdk-java): pin that a path without a leading slash is never sent
Yudhi Armyndharisbad6f97d7d27
diff --git a/sdk/java/src/test/java/com/rmyndharis/openwa/ClientTest.java b/sdk/java/src/test/java/com/rmyndharis/openwa/ClientTest.javaindex 4202144f8..27c7fcd0b 100644--- a/sdk/java/src/test/java/com/rmyndharis/openwa/ClientTest.java+++ b/sdk/java/src/test/java/com/rmyndharis/openwa/ClientTest.java@@ -44,6 +44,14 @@ class ClientTest {assertNull(tx.lastRequest());}+ @Test+ void pathWithoutLeadingSlashIsRefusedBeforeSending() {+ // Appended to the base URL, such a path could move the request and its API key to another host.+ assertThrows(IllegalArgumentException.class,+ () -> client.requestVoid(HttpMethod.GET, "@evil.example/api/sessions", null, null));+ assertNull(tx.lastRequest());+ }+@Testvoid apiErrorCarriesCodeRetryAfterAndHeaders() {tx.respondRaw(429, "{\"statusCode\":429,\"message\":\"ThrottlerException: Too Many Requests\"}"