Skip to content

Commit 6604f96

Browse files
committed
Fix up the new approach based on PR feedback
1 parent 71849ae commit 6604f96

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

Sources/OpenAPIRuntime/Conversion/Converter+Server.swift

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -77,30 +77,23 @@ extension Converter {
7777
// */* as a concrete content type is NOT a match for an Accept header of foo/*
7878
break
7979
case .anySubtype(type: let substringType):
80+
// Only match if the types match.
8081
if substringType.lowercased() == acceptType.lowercased() {
8182
return
8283
}
83-
case .concrete(type: let substringType, subtype: let substringSubtype):
84-
if
85-
substringType.lowercased() == acceptType.lowercased() &&
86-
87-
{
84+
case .concrete(type: let substringType, _):
85+
if substringType.lowercased() == acceptType.lowercased() {
8886
return
8987
}
90-
91-
if accept.lowercased() == substringType.lowercased()
92-
&& subtype.lowercased() == substringSubtype.lowercased()
88+
}
89+
case (.concrete(type: let acceptType, subtype: let acceptSubtype), let substring):
90+
if case let .concrete(substringType, substringSubtype) = substring {
91+
if acceptType.lowercased() == substringType.lowercased()
92+
&& acceptSubtype.lowercased() == substringSubtype.lowercased()
9393
{
9494
return
9595
}
9696
}
97-
98-
case .concrete(type: let type, subtype: let subtype):
99-
if type.lowercased() == substringType.lowercased()
100-
&& subtype.lowercased() == substringSubtype.lowercased()
101-
{
102-
return
103-
}
10497
}
10598
}
10699
throw RuntimeError.unexpectedAcceptHeader(acceptHeader)

0 commit comments

Comments
 (0)