@@ -266,36 +266,25 @@ private static String urlEncodePair(final String key, final String value) throws
266266 static Map <String , String > getHeaders (String apiKey ) {
267267 Map <String , String > headers = new HashMap <String , String >();
268268 headers .put ("Accept-Charset" , CHARSET );
269- headers .put ("User-Agent" , String .format ("EasyPost/v2 JavaClient/%s Java/%s" , EasyPost .VERSION ,
270- System .getProperty ("java.version" )));
269+ headers .put ("User-Agent" , String .format ("EasyPost/v2 JavaClient/%s Java/%s OS/%s OSVersion/%s OSArch/%s " +
270+ "Implementation/%s" , EasyPost .VERSION , System .getProperty ("java.version" ),
271+ convertSpaceToHyphen (System .getProperty ("os.name" )), System .getProperty ("os.version" ),
272+ convertSpaceToHyphen (System .getProperty ("os.arch" )),
273+ convertSpaceToHyphen (System .getProperties ().getProperty ("java.vm.name" ))));
271274
272275 if (apiKey == null ) {
273276 apiKey = EasyPost .apiKey ;
274277 }
275278
276279 headers .put ("Authorization" , String .format ("Bearer %s" , apiKey ));
277280
278- // debug headers
279- String [] propertyNames = {
280- "os.name" ,
281- "os.version" ,
282- "os.arch" ,
283- "java.version" ,
284- "java.vendor" ,
285- "java.vm.version" ,
286- "java.vm.vendor"
287- };
288- Map <String , String > propertyMap = new HashMap <String , String >();
289- for (String propertyName : propertyNames ) {
290- propertyMap .put (propertyName , System .getProperty (propertyName ));
291- }
292- propertyMap .put ("lang" , "Java" );
293- propertyMap .put ("publisher" , "EasyPost" );
294- headers .put ("X-Client-User-Agent" , GSON .toJson (propertyMap ));
295-
296281 return headers ;
297282 }
298283
284+ private static String convertSpaceToHyphen (String string ) {
285+ return string .replace (' ' , '-' );
286+ }
287+
299288 private static javax .net .ssl .HttpsURLConnection createEasyPostConnection (final String url , final String apiKey ,
300289 final String method ) throws IOException {
301290 HttpsURLConnection conn = null ;
0 commit comments