Method: FormAPI::ApiClient#select_header_content_type
- Defined in:
- lib/form_api/api_client.rb
#select_header_content_type(content_types) ⇒ String
Return Content-Type header based on an array of content types provided.
353 354 355 356 357 358 359 |
# File 'lib/form_api/api_client.rb', line 353 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 |