Java Code Examples for io.swagger.models.Response#getHeaders()

The following examples show how to use io.swagger.models.Response#getHeaders() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultCodegen.java    From TypeScript-Microservices with MIT License 5 votes vote down vote up
private void addHeaders(Response response, List<CodegenProperty> target) {
    if (response.getHeaders() != null) {
        for (Map.Entry<String, Property> headers : response.getHeaders().entrySet()) {
            target.add(fromProperty(headers.getKey(), headers.getValue()));
        }
    }
}
 
Example 2
Source File: AbstractOperationGenerator.java    From servicecomb-java-chassis with Apache License 2.0 5 votes vote down vote up
private void addHeaderToResponse() {
  for (Entry<String, Response> responseEntry : swaggerOperation.getResponses().entrySet()) {
    Response response = responseEntry.getValue();

    for (Entry<String, Property> entry : methodResponseHeaders.entrySet()) {
      if (response.getHeaders() != null && response.getHeaders().containsKey(entry.getKey())) {
        continue;
      }

      response.addHeader(entry.getKey(), entry.getValue());
    }
  }
}