Skip to content

Commit 3ee0a86

Browse files
committed
setting readtimeout to 0 for app upload
1 parent b9a9f60 commit 3ee0a86

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/java/com/browserstack/appautomate/AppAutomateClient.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import com.browserstack.automate.model.Build;
1313
import com.browserstack.automate.model.Session;
1414
import com.browserstack.client.BrowserStackClient;
15+
import com.browserstack.client.BrowserStackRequest;
1516
import com.browserstack.client.exception.BrowserStackException;
1617
import com.browserstack.client.util.Tools;
1718
import com.google.api.client.http.FileContent;
@@ -75,8 +76,11 @@ public AppUploadResponse uploadApp(String filePath)
7576
String.format("form-data; name=\"file\"; filename=\"%s\"", file.getName())));
7677
content.addPart(part);
7778

78-
AppUploadResponse appUploadResponse =
79-
newRequest(Method.POST, "/upload").body(content).asObject(AppUploadResponse.class);
79+
BrowserStackRequest request = newRequest(Method.POST, "/upload");
80+
// Setting read timeout to 0(infinity), as for large files it takes a lot of time.
81+
request.getHttpRequest().setReadTimeout(0);
82+
83+
AppUploadResponse appUploadResponse = request.body(content).asObject(AppUploadResponse.class);
8084

8185
if (appUploadResponse == null || Tools.isStringEmpty(appUploadResponse.getAppUrl())) {
8286
throw new AppAutomateException("App upload failed!", 0);

0 commit comments

Comments
 (0)