Fix text content factory with default media type

This commit is contained in:
Sipke Schoorstra 2023-01-31 12:40:29 +01:00
parent b21e79c0c4
commit 55670ea949

View file

@ -22,6 +22,10 @@ public class TextContentFactory : IHttpContentFactory
public HttpContent CreateHttpContent(object content, string contentType)
{
var text = content as string ?? "";
if (string.IsNullOrWhiteSpace(contentType))
contentType = MediaTypeNames.Text.Plain;
return new StringContent(text, Encoding.UTF8, contentType);
}
}