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

fix: Expose server message in 400 responses #264

Merged
merged 5 commits into from
Jun 17, 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
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[bumpversion]
commit = True
tag = False
current_version = v4.14.0
current_version = v4.14.1
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<build>\d+))?
serialize =
{major}.{minor}.{patch}-{release}{build}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build Java CI
name: Build & Test
on:
push:
branches:
Expand Down Expand Up @@ -81,4 +81,4 @@ jobs:
run: ./gradlew build

- name: Run Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ When you use Maven as your build tool, you can manage dependencies in the `pom.x
<dependency>
<groupId>com.tokbox</groupId>
<artifactId>opentok-server-sdk</artifactId>
<version>4.14.0</version>
<version>4.14.1</version>
</dependency>
```

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

```groovy
dependencies {
compile group: 'com.tokbox', name: 'opentok-server-sdk', version: '4.14.0'
compile group: 'com.tokbox', name: 'opentok-server-sdk', version: '4.14.1'
}
```

Expand Down
12 changes: 5 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ plugins {

group = 'com.tokbox'
archivesBaseName = 'opentok-server-sdk'
version = '4.14.0'
version = '4.14.1'

ext.githubPath = "opentok/$archivesBaseName"

Expand All @@ -21,15 +21,13 @@ repositories {

dependencies {
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.wiremock:wiremock:3.5.4'
testImplementation 'org.xmlunit:xmlunit-core:2.10.0'
testImplementation 'net.minidev:json-smart:2.5.1'
testImplementation 'com.google.guava:guava:33.2.0-jre'
testImplementation 'org.wiremock:wiremock:3.6.0'
testImplementation 'com.google.guava:guava:33.2.1-jre'

implementation 'commons-lang:commons-lang:2.6'
implementation 'commons-codec:commons-codec:1.17.0'
implementation 'io.netty:netty-codec-http:4.1.109.Final'
implementation 'io.netty:netty-handler:4.1.109.Final'
implementation 'io.netty:netty-codec-http:4.1.111.Final'
implementation 'io.netty:netty-handler:4.1.111.Final'
implementation 'org.asynchttpclient:async-http-client:2.12.3'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.17.1'
implementation 'org.bitbucket.b_c:jose4j:0.9.6'
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/opentok/constants/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
package com.opentok.constants;

public class Version {
public static final String VERSION = "4.14.0";
public static final String VERSION = "4.14.1";
}
87 changes: 38 additions & 49 deletions src/main/java/com/opentok/util/HttpClient.java

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions src/test/java/com/opentok/test/OpenTokTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2720,8 +2720,15 @@ public void testConnectAudioStreamErrors() throws OpenTokException {
String uri = "ws://service.com/wsendpoint";
AudioConnectorProperties connectProperties = new AudioConnectorProperties.Builder(uri).build();

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

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