Method: OpenapiClient::ApiClient#select_header_content_type
- Defined in:
- lib/openapi_client/api_client.rb
#select_header_content_type(content_types) ⇒ String
Return Content-Type header based on an array of content types provided.
332 333 334 335 336 337 338 |
# File 'lib/openapi_client/api_client.rb', line 332 def select_header_content_type(content_types) # use application/json by default return 'application/json' if content_types.nil? || content_types.empty? # use JSON when present, otherwise use the first one json_content_type = content_types.find { |s| json_mime?(s) } json_content_type || content_types.first end |