Fix for "complex" content type in HTTP Endpoint and HTTP Send request

This commit is contained in:
tomy2105 2021-03-30 16:07:02 +02:00 committed by Sipke Schoorstra
parent 89e1c604c9
commit 4384bdaab4
2 changed files with 4 additions and 2 deletions

View file

@ -86,8 +86,9 @@ namespace Elsa.Activities.Http
private IHttpRequestBodyParser SelectContentParser(string contentType)
{
string? simpleContentType = contentType?.Split(';').First();
var formatters = _parsers.OrderByDescending(x => x.Priority).ToList();
return formatters.FirstOrDefault(x => x.SupportedContentTypes.Contains(contentType, StringComparer.OrdinalIgnoreCase)) ?? formatters.Last();
return formatters.FirstOrDefault(x => x.SupportedContentTypes.Contains(simpleContentType, StringComparer.OrdinalIgnoreCase)) ?? formatters.Last();
}
}
}

View file

@ -125,9 +125,10 @@ namespace Elsa.Activities.Http
private IHttpResponseBodyParser SelectContentParser(string contentType)
{
string? simpleContentType = contentType?.Split(';').First();
var formatters = _parsers.OrderByDescending(x => x.Priority).ToList();
return formatters.FirstOrDefault(
x => x.SupportedContentTypes.Contains(contentType, StringComparer.OrdinalIgnoreCase)
x => x.SupportedContentTypes.Contains(simpleContentType, StringComparer.OrdinalIgnoreCase)
) ?? formatters.Last();
}