-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cd8dca6
commit 23e1225
Showing
4 changed files
with
77 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -388,7 +388,7 @@ public void getUserByEmail() throws Exception { | |
.add(GetUserApiRequest.INCLUDE_CUSTOM_PROFILE_FIELDS, "true") | ||
.get(); | ||
|
||
stubZulipResponse(GET, "/users/test@test.com", params, "getUser.json"); | ||
stubZulipResponse(GET, "/users/test%40test.com", params, "getUser.json"); | ||
|
||
User user = zulip.users().getUser("[email protected]") | ||
.withClientGravatar(true) | ||
|
@@ -442,7 +442,7 @@ public void updateUser() throws Exception { | |
|
||
@Test | ||
public void userPresence() throws Exception { | ||
stubZulipResponse(GET, "/users/test@test.com/presence", "getUserPresence.json"); | ||
stubZulipResponse(GET, "/users/test%40test.com/presence", "getUserPresence.json"); | ||
|
||
Map<String, UserPresenceDetail> presence = zulip.users().getUserPresence("[email protected]").execute(); | ||
assertEquals(2, presence.size()); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,7 @@ public class ZulipCommonsHttpClientTest extends ZulipApiTestBase { | |
|
||
@Test | ||
public void errorResponseCodeThrowsZulipClientException() throws Exception { | ||
server.stubFor(request("GET", urlPathEqualTo("/api/v1/")) | ||
server.stubFor(request("GET", urlPathEqualTo("/api/v1")) | ||
.willReturn(aResponse() | ||
.withStatus(500) | ||
.withBody((String) null))); | ||
|
@@ -46,7 +46,7 @@ public void errorResponseCodeThrowsZulipClientException() throws Exception { | |
ZulipCommonsHttpClient client = new ZulipCommonsHttpClient(configuration); | ||
|
||
assertThrows(ZulipClientException.class, () -> { | ||
client.get("/", Collections.emptyMap(), ZulipApiResponse.class); | ||
client.get("", Collections.emptyMap(), ZulipApiResponse.class); | ||
}); | ||
} | ||
|
||
|
@@ -64,7 +64,7 @@ public void invalidRateLimitReset() throws Exception { | |
ZulipCommonsHttpClient client = new ZulipCommonsHttpClient(configuration); | ||
|
||
try { | ||
client.get("/", Collections.emptyMap(), ZulipApiResponse.class); | ||
client.get("", Collections.emptyMap(), ZulipApiResponse.class); | ||
} catch (ZulipClientException e) { | ||
ZulipRateLimitExceededException cause = (ZulipRateLimitExceededException) e.getCause(); | ||
assertEquals(0, cause.getReteLimitReset()); | ||
|
@@ -95,7 +95,7 @@ public void proxyServer() throws Exception { | |
|
||
@Test | ||
public void proxyServerAuthentication() throws Exception { | ||
CountDownLatch latch = new CountDownLatch(3); | ||
CountDownLatch latch = new CountDownLatch(2); | ||
FakeServer server = new FakeServer(latch, true); | ||
server.start(); | ||
|
||
|
@@ -125,7 +125,7 @@ public void ignoredParameters() throws Exception { | |
ZulipConfiguration configuration = new ZulipConfiguration(zulipUrl, "[email protected]", "abc123"); | ||
ZulipCommonsHttpClient client = new ZulipCommonsHttpClient(configuration); | ||
|
||
ZulipApiResponse response = client.get("/test", Collections.emptyMap(), ZulipApiResponse.class); | ||
ZulipApiResponse response = client.get("test", Collections.emptyMap(), ZulipApiResponse.class); | ||
List<String> ignoredParametersUnsupported = response.getIgnoredParametersUnsupported(); | ||
assertNotNull(ignoredParametersUnsupported); | ||
assertEquals(2, ignoredParametersUnsupported.size()); | ||
|
@@ -156,6 +156,8 @@ void start() { | |
InputStreamReader isr = new InputStreamReader(accept.getInputStream()); | ||
BufferedReader reader = new BufferedReader(isr); | ||
String line = reader.readLine(); | ||
latch.countDown(); | ||
|
||
while (!line.isEmpty()) { | ||
if (secure && proxyAuthHeaderSent && line.startsWith("Proxy-Authorization")) { | ||
latch.countDown(); | ||
|
@@ -181,7 +183,6 @@ void start() { | |
} | ||
|
||
outputStream.write("HTTP/1.1 200 OK\r\n".getBytes(StandardCharsets.UTF_8)); | ||
outputStream.write("Content-Length: ".getBytes(StandardCharsets.UTF_8)); | ||
outputStream.write( | ||
String.format("Content-Length: %d\r\n", response.length).getBytes(StandardCharsets.UTF_8)); | ||
outputStream.write("Content-Type: Application/json\r\n\r\n".getBytes(StandardCharsets.UTF_8)); | ||
|