Skip to content

Commit 3ce2c9b

Browse files
committed
cache response.body call just in case
1 parent f3d92f9 commit 3ce2c9b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main/java/io/socket/engineio/client/transports/PollingXHR.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,13 +237,14 @@ private void onResponseHeaders(Map<String, List<String>> headers) {
237237
}
238238

239239
private void onLoad() {
240-
String contentType = response.body().contentType().toString();
240+
ResponseBody body = response.body();
241+
String contentType = body.contentType().toString();
241242

242243
try {
243244
if (BINARY_CONTENT_TYPE.equalsIgnoreCase(contentType)) {
244-
this.onData(response.body().bytes());
245+
this.onData(body.bytes());
245246
} else {
246-
this.onData(response.body().string());
247+
this.onData(body.string());
247248
}
248249
} catch (IOException e) {
249250
this.onError(e);

0 commit comments

Comments
 (0)