Fix text content factory with default media type
This commit is contained in:
parent
b21e79c0c4
commit
55670ea949
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue