Method: OpenApiOpenAIClient::ApiClient#select_header_content_type
- Defined in:
- lib/openapi_openai/api_client.rb
#select_header_content_type(content_types) ⇒ String
Return Content-Type header based on an array of content types provided.
340 341 342 343 344 345 346 |
# File 'lib/openapi_openai/api_client.rb', line 340 def select_header_content_type(content_types) # return nil by default return 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 |