mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-10 21:02:42 +00:00
[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:
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user