@@ -75,6 +75,7 @@ public class GitLabApiClient implements AutoCloseable {
7575 private Long sudoAsId ;
7676 private Integer connectTimeout ;
7777 private Integer readTimeout ;
78+ private String userAgentHeader ;
7879
7980 /**
8081 * Construct an instance to communicate with a GitLab API server using the specified GitLab API version,
@@ -871,6 +872,9 @@ protected Invocation.Builder invocation(URL url, MultivaluedMap<String, String>
871872 } else {
872873 builder = builder .header (authHeader , authValue ).accept (accept );
873874 }
875+ if (userAgentHeader != null ) {
876+ builder .header ("User-Agent" , userAgentHeader );
877+ }
874878
875879 // If sudo as ID is set add the Sudo header
876880 if (sudoAsId != null && sudoAsId .intValue () > 0 ) builder = builder .header (SUDO_HEADER , sudoAsId );
@@ -955,6 +959,24 @@ public void setIgnoreCertificateErrors(boolean ignoreCertificateErrors) {
955959 }
956960 }
957961
962+ /**
963+ * Returns the configured custom 'User-Agent' header value
964+ *
965+ * @return User-Agent header value
966+ */
967+ public String getUserAgentHeader () {
968+ return userAgentHeader ;
969+ }
970+
971+ /**
972+ * Configures a custom value for the 'User-Agent' header
973+ *
974+ * @param userAgentHeader User-Agent header value
975+ */
976+ public void setUserAgentHeader (String userAgentHeader ) {
977+ this .userAgentHeader = userAgentHeader ;
978+ }
979+
958980 /**
959981 * Sets up Jersey client to ignore certificate errors.
960982 *
0 commit comments