File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
main/java/io/visual_regression_tracker/sdk_java
test/java/io/visual_regression_tracker/sdk_java Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 1313import okhttp3 .ResponseBody ;
1414
1515import java .io .IOException ;
16+ import java .util .Optional ;
1617
1718public class VisualRegressionTracker {
1819 static final MediaType JSON = MediaType .get ("application/json; charset=utf-8" );
@@ -51,8 +52,11 @@ void startBuild() throws IOException {
5152 if (response .code () == 401 ) {
5253 throw new TestRunException ("Unauthorized" );
5354 }
54- ResponseBody responseBody = response .body ();
55- BuildResponse buildDTO = new Gson ().fromJson (responseBody .string (), BuildResponse .class );
55+
56+ String responseBody = Optional .ofNullable (response .body ())
57+ .orElseThrow (() -> new TestRunException ("Cannot get response body" ))
58+ .string ();
59+ BuildResponse buildDTO = new Gson ().fromJson (responseBody , BuildResponse .class );
5660 this .buildId = buildDTO .getId ();
5761 this .projectId = buildDTO .getProjectId ();
5862 }
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ public class VisualRegressionTrackerTest {
2424 MockWebServer server ;
2525 VisualRegressionTracker vrt ;
2626 VisualRegressionTrackerConfig config = new VisualRegressionTrackerConfig (
27- "http://localhost:4200 " ,
27+ "http://localhost" ,
2828 "733c148e-ef70-4e6d-9ae5-ab22263697cc" ,
2929 "XHGDZDFD3GMJDNM87JKEMP0JS1G5" ,
3030 "develop"
You can’t perform that action at this time.
0 commit comments