[ruby/typescript-angular] Configure Accept header
Created by: davidvanlaatum
Description
There appears to be no way of specifying what format you want a response in for endpoints that can return multiple.
eg in the generated ruby code (also looks to me like the opts argument is never used)
def get_domain_by_name_with_http_info(domain_name, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: DnsApi.get_domain_by_name ...'
end
# verify the required parameter 'domain_name' is set
if @api_client.config.client_side_validation && domain_name.nil?
fail ArgumentError, "Missing the required parameter 'domain_name' when calling DnsApi.get_domain_by_name"
end
# resource path
local_var_path = '/api/v1/dns/domains/{domain_name}'.sub('{' + 'domain_name' + '}', domain_name.to_s)
# query parameters
query_params = {}
# header parameters
header_params = {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/dns'])
# form parameters
form_params = {}
# http body (model)
post_body = nil
auth_names = []
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => 'Domain')
if @api_client.config.debugging
@api_client.config.logger.debug "API called: DnsApi#get_domain_by_name\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
def select_header_accept(accepts)
return nil if accepts.nil? || accepts.empty?
# use JSON when present, otherwise use all of the provided
json_accept = accepts.find { |s| json_mime?(s) }
json_accept || accepts.join(',')
end
openapi-generator version
3.1.2
OpenAPI declaration file content or url
Command line used for generation
openapi-generator generate -i http://localhost:3000/api/v1/swagger.json -g ruby