Add status code and response headers of the last request to java and csharp templates per #990

This commit is contained in:
ivanmartinvalle
2015-08-24 18:29:01 -05:00
parent 15e336b90a
commit 52dc7e210c
2 changed files with 38 additions and 2 deletions

View File

@@ -49,6 +49,9 @@ public class ApiClient {
private Map<String, Authentication> authentications;
private int statusCode;
private Map<String, List<String>> responseHeaders;
private DateFormat dateFormat;
public ApiClient() {
@@ -80,6 +83,20 @@ public class ApiClient {
return this;
}
/**
* Gets the status code of the previous request
*/
public int getStatusCode() {
return statusCode;
}
/**
* Gets the response headers of the previous request
*/
public Map<String, List<String>> getResponseHeaders() {
return responseHeaders;
}
/**
* Get authentications (key: authentication name, value: authentication).
*/
@@ -494,6 +511,9 @@ public class ApiClient {
ClientResponse response = getAPIResponse(path, method, queryParams, body, binaryBody, headerParams, formParams, accept, contentType, authNames);
statusCode = response.getStatusInfo().getStatusCode();
responseHeaders = response.getHeaders();
if(response.getStatusInfo() == ClientResponse.Status.NO_CONTENT) {
return null;
} else if (response.getStatusInfo().getFamily() == Family.SUCCESSFUL) {