We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1a86f55 commit c468e6fCopy full SHA for c468e6f
1 file changed
lib/openapi_first/router/find_content.rb
@@ -8,8 +8,10 @@ def self.call(contents, content_type)
8
return contents[nil] if content_type.nil? || content_type.empty?
9
10
contents.fetch(content_type) do
11
- type = content_type.split(';')[0]
12
- contents[type] || contents["#{type.split('/')[0]}/*"] || contents['*/*'] || contents[nil]
+ semi = content_type.index(';')
+ type = semi ? content_type[0, semi] : content_type
13
+ slash = type.index('/') || type.length
14
+ contents[type] || contents["#{type[0, slash]}/*"] || contents['*/*'] || contents[nil]
15
end
16
17
0 commit comments