Skip to content

Commit 62cc25b

Browse files
committed
Copilot feedback
1 parent 6562dbf commit 62cc25b

File tree

1 file changed

+19
-23
lines changed

1 file changed

+19
-23
lines changed

src/test/java/com/pipedream/api/ProxyClientWireTest.java

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -141,22 +141,20 @@ public void testGetOctetStreamResponse() throws Exception {
141141
.setHeader("Content-Type", "application/octet-stream")
142142
.setBody(buffer));
143143

144-
ProxyResponse response = client.proxy().get(TEST_URL, createGetRequest());
145-
146-
// Verify response type
147-
assertTrue(response.isStream(), "Response should be a stream");
148-
assertFalse(response.isJson(), "Response should not be JSON");
144+
try (ProxyResponse response = client.proxy().get(TEST_URL, createGetRequest())) {
149145

150-
// Verify binary content
151-
byte[] actualData = readAllBytes(response.stream());
152-
assertArrayEquals(binaryData, actualData, "Binary data should match");
146+
// Verify response type
147+
assertTrue(response.isStream(), "Response should be a stream");
148+
assertFalse(response.isJson(), "Response should not be JSON");
153149

154-
// Verify content type is preserved
155-
assertTrue(response.getContentType().isPresent());
156-
assertEquals("application/octet-stream", response.getContentType().get());
150+
// Verify binary content
151+
byte[] actualData = readAllBytes(response.stream());
152+
assertArrayEquals(binaryData, actualData, "Binary data should match");
157153

158-
// Clean up
159-
response.close();
154+
// Verify content type is preserved
155+
assertTrue(response.getContentType().isPresent());
156+
assertEquals("application/octet-stream", response.getContentType().get());
157+
}
160158

161159
// Verify request was made correctly
162160
RecordedRequest request = server.takeRequest();
@@ -243,18 +241,16 @@ public void testAsyncGetOctetStreamResponse() throws Exception {
243241
.setBody(buffer));
244242

245243
CompletableFuture<ProxyResponse> future = asyncClient.proxy().get(TEST_URL, createGetRequest());
246-
ProxyResponse response = future.get(10, TimeUnit.SECONDS);
247-
248-
// Verify response type
249-
assertTrue(response.isStream(), "Response should be a stream");
250-
assertFalse(response.isJson(), "Response should not be JSON");
244+
try (ProxyResponse response = future.get(10, TimeUnit.SECONDS)) {
251245

252-
// Verify binary content
253-
byte[] actualData = readAllBytes(response.stream());
254-
assertArrayEquals(binaryData, actualData, "Binary data should match");
246+
// Verify response type
247+
assertTrue(response.isStream(), "Response should be a stream");
248+
assertFalse(response.isJson(), "Response should not be JSON");
255249

256-
// Clean up
257-
response.close();
250+
// Verify binary content
251+
byte[] actualData = readAllBytes(response.stream());
252+
assertArrayEquals(binaryData, actualData, "Binary data should match");
253+
}
258254

259255
// Verify request was made correctly
260256
RecordedRequest request = server.takeRequest();

0 commit comments

Comments
 (0)