[Java][jersey2] Add a getter for the User-Agent header value (#6831)

* [Java][jersey2] Add a getter for the User-Agent header value

* generate samples
This commit is contained in:
Hippolyte HENRY
2020-07-02 05:45:30 +02:00
committed by GitHub
parent 1fe7d703d7
commit 63c1b1350d
2 changed files with 20 additions and 0 deletions

View File

@@ -69,6 +69,7 @@ public class ApiClient {
protected Map<String, String> defaultHeaderMap = new HashMap<String, String>();
protected Map<String, String> defaultCookieMap = new HashMap<String, String>();
protected String basePath = "http://petstore.swagger.io:80/v2";
protected String userAgent;
private static final Logger log = Logger.getLogger(ApiClient.class.getName());
protected List<ServerConfiguration> servers = new ArrayList<ServerConfiguration>(Arrays.asList(
@@ -517,10 +518,19 @@ public class ApiClient {
* @return API client
*/
public ApiClient setUserAgent(String userAgent) {
userAgent = userAgent;
addDefaultHeader("User-Agent", userAgent);
return this;
}
/**
* Get the User-Agent header's value.
* @return User-Agent string
*/
public String getUserAgent(){
return userAgent;
}
/**
* Add a default header.
*