Skip to content

Commit 26b3244

Browse files
authored
fix: Expose server message in 400 responses (#264)
* Bump version: v4.14.0 → v4.14.1 * Bump dependency versions * Expose error message detail for 400 responses * Update CI job name * Re-add 408 response handling
1 parent 4df29bc commit 26b3244

File tree

7 files changed

+58
-64
lines changed

7 files changed

+58
-64
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[bumpversion]
22
commit = True
33
tag = False
4-
current_version = v4.14.0
4+
current_version = v4.14.1
55
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<build>\d+))?
66
serialize =
77
{major}.{minor}.{patch}-{release}{build}

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build Java CI
1+
name: Build & Test
22
on:
33
push:
44
branches:
@@ -81,4 +81,4 @@ jobs:
8181
run: ./gradlew build
8282

8383
- name: Run Codecov
84-
uses: codecov/codecov-action@v3
84+
uses: codecov/codecov-action@v4

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ When you use Maven as your build tool, you can manage dependencies in the `pom.x
4545
<dependency>
4646
<groupId>com.tokbox</groupId>
4747
<artifactId>opentok-server-sdk</artifactId>
48-
<version>4.14.0</version>
48+
<version>4.14.1</version>
4949
</dependency>
5050
```
5151

@@ -55,7 +55,7 @@ When you use Gradle as your build tool, you can manage dependencies in the `buil
5555

5656
```groovy
5757
dependencies {
58-
compile group: 'com.tokbox', name: 'opentok-server-sdk', version: '4.14.0'
58+
compile group: 'com.tokbox', name: 'opentok-server-sdk', version: '4.14.1'
5959
}
6060
```
6161

build.gradle

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ plugins {
1111

1212
group = 'com.tokbox'
1313
archivesBaseName = 'opentok-server-sdk'
14-
version = '4.14.0'
14+
version = '4.14.1'
1515

1616
ext.githubPath = "opentok/$archivesBaseName"
1717

@@ -21,15 +21,13 @@ repositories {
2121

2222
dependencies {
2323
testImplementation 'junit:junit:4.13.2'
24-
testImplementation 'org.wiremock:wiremock:3.5.4'
25-
testImplementation 'org.xmlunit:xmlunit-core:2.10.0'
26-
testImplementation 'net.minidev:json-smart:2.5.1'
27-
testImplementation 'com.google.guava:guava:33.2.0-jre'
24+
testImplementation 'org.wiremock:wiremock:3.6.0'
25+
testImplementation 'com.google.guava:guava:33.2.1-jre'
2826

2927
implementation 'commons-lang:commons-lang:2.6'
3028
implementation 'commons-codec:commons-codec:1.17.0'
31-
implementation 'io.netty:netty-codec-http:4.1.109.Final'
32-
implementation 'io.netty:netty-handler:4.1.109.Final'
29+
implementation 'io.netty:netty-codec-http:4.1.111.Final'
30+
implementation 'io.netty:netty-handler:4.1.111.Final'
3331
implementation 'org.asynchttpclient:async-http-client:2.12.3'
3432
implementation 'com.fasterxml.jackson.core:jackson-databind:2.17.1'
3533
implementation 'org.bitbucket.b_c:jose4j:0.9.6'

src/main/java/com/opentok/constants/Version.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
package com.opentok.constants;
99

1010
public class Version {
11-
public static final String VERSION = "4.14.0";
11+
public static final String VERSION = "4.14.1";
1212
}

src/main/java/com/opentok/util/HttpClient.java

Lines changed: 38 additions & 49 deletions
Large diffs are not rendered by default.

src/test/java/com/opentok/test/OpenTokTest.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2720,8 +2720,15 @@ public void testConnectAudioStreamErrors() throws OpenTokException {
27202720
String uri = "ws://service.com/wsendpoint";
27212721
AudioConnectorProperties connectProperties = new AudioConnectorProperties.Builder(uri).build();
27222722

2723-
stubFor(post(urlEqualTo(url)).willReturn(aResponse().withStatus(400)));
2724-
assertThrows(RequestException.class, () -> sdk.connectAudioStream(sessionId, apiSecret, connectProperties));
2723+
String expected400Msg = "Oops! Something went wrong - bad request.";
2724+
stubFor(post(urlEqualTo(url)).willReturn(aResponse().withStatus(400).withBody(expected400Msg)));
2725+
try {
2726+
AudioConnector parsed = sdk.connectAudioStream(sessionId, apiSecret, connectProperties);
2727+
fail("Expected RequestException, but got "+parsed);
2728+
}
2729+
catch (RequestException ex) {
2730+
assertEquals(expected400Msg, ex.getMessage());
2731+
}
27252732

27262733
stubFor(post(urlEqualTo(url)).willReturn(aResponse().withStatus(403)));
27272734
assertThrows(RequestException.class, () -> sdk.connectAudioStream(sessionId, apiSecret, connectProperties));

0 commit comments

Comments
 (0)