Skip to content

Commit 3a30970

Browse files
committed
Engine: Content-Type may contain additional parameters
When comparing the media type split by ';' so we do not accidentally include additional parameters like charset or boundary or some other bogus data after the ';'.
1 parent a53034c commit 3a30970

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Spark.Engine/Extensions/HttpHeadersExtensions.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ public static class HttpRequestExtensions
2323
public static bool IsContentTypeHeaderFhirMediaType(string contentType)
2424
{
2525
if (string.IsNullOrEmpty(contentType)) return false;
26-
return ContentType.XML_CONTENT_HEADERS.Contains(contentType)
27-
|| ContentType.JSON_CONTENT_HEADERS.Contains(contentType);
26+
var mediaType = contentType.Split(';')[0];
27+
return ContentType.XML_CONTENT_HEADERS.Contains(mediaType, StringComparer.OrdinalIgnoreCase)
28+
|| ContentType.JSON_CONTENT_HEADERS.Contains(mediaType, StringComparer.OrdinalIgnoreCase);
2829
}
2930

3031
public static string GetParameter(this HttpRequest request, string key)

0 commit comments

Comments
 (0)