@@ -141,17 +141,11 @@ public void checkServerTrusted(
141141 this .client = builder .build ();
142142 }
143143
144- @ Nonnull
145144 public String getServerVersion () throws InfluxDBApiException {
146- HttpRequest request = HttpRequest .newBuilder ()
147- .uri (URI .create (this .baseUrl + "ping" ))
148- .GET ()
149- .build ();
150-
151145 HttpResponse <String > response ;
152146 String influxdbVersion ;
153147 try {
154- response = client . send ( request , HttpResponse . BodyHandlers . ofString () );
148+ response = request ( "ping" , HttpMethod . GET , null , null , null );
155149 influxdbVersion = extractServerVersion (response );
156150 } catch (Exception e ) {
157151 throw new InfluxDBApiException (e );
@@ -169,7 +163,7 @@ private String extractServerVersion(final HttpResponse<String> response) throws
169163 return version ;
170164 }
171165
172- void request (@ Nonnull final String path ,
166+ HttpResponse < String > request (@ Nonnull final String path ,
173167 @ Nonnull final HttpMethod method ,
174168 @ Nullable final byte [] data ,
175169 @ Nullable final Map <String , String > queryParams ,
@@ -264,6 +258,8 @@ void request(@Nonnull final String path,
264258 String message = String .format ("HTTP status code: %d; Message: %s" , statusCode , reason );
265259 throw new InfluxDBApiHttpException (message , response .headers (), response .statusCode ());
266260 }
261+
262+ return response ;
267263 }
268264
269265 private X509TrustManager getX509TrustManagerFromFile (@ Nonnull final String filePath ) {
0 commit comments