File tree Expand file tree Collapse file tree 3 files changed +26
-1
lines changed
java/com/browserstack/client Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 107107 </executions >
108108 </plugin >
109109 </plugins >
110+ <resources >
111+ <resource >
112+ <directory >src/main/resources</directory >
113+ <filtering >true</filtering >
114+ </resource >
115+ </resources >
110116 </build >
111117
112118 <dependencies >
Original file line number Diff line number Diff line change 1919
2020public class BrowserStackRequest {
2121
22- private static final String USER_AGENT = "browserstack-automate-java/1.0" ;
22+ private static final String releaseVersion = (getReleaseProperties ("release.version" ) != null ) ? getReleaseProperties ("release.version" ) : "1.0" ;
23+ private static final String USER_AGENT = "browserstack-automate-java/" +releaseVersion ;
2324 private final HttpRequest httpRequest ;
2425
2526 public BrowserStackRequest (HttpRequest httpRequest ) {
@@ -42,6 +43,23 @@ private static String getRawBody(InputStream inputStream) throws IOException {
4243 return result .toString ("UTF-8" );
4344 }
4445
46+ private static String getReleaseProperties (String key ) {
47+ Properties properties = new Properties ();
48+ try (InputStream input = BrowserStackRequest .class .getClassLoader ().getResourceAsStream ("release.properties" )) {
49+ if (input != null ) {
50+ properties .load (input );
51+ String releaseVersion = properties .getProperty ("release.version" );
52+ System .out .println ("HARI DEBUG Release Version: " + releaseVersion );
53+ return releaseVersion ;
54+ } else {
55+ System .err .println ("HARI DEBUG version.properties not found" );
56+ }
57+ } catch (IOException e ) {
58+ e .printStackTrace ();
59+ }
60+ return null ;
61+ }
62+
4563 public BrowserStackRequest header (String name , String value ) {
4664 httpRequest .getHeaders ().put (name , value );
4765 return this ;
Original file line number Diff line number Diff line change 1+
You can’t perform that action at this time.
0 commit comments