using System.Net.Http; using System.Net.Http.Headers; using JetBrains.Annotations; using Stef.Validation; namespace WireMock.Http { internal static class StringContentHelper { /// /// Creates a StringContent object. /// /// The string content (cannot be null) /// The ContentType (can be null) /// StringContent internal static StringContent Create([NotNull] string content, [CanBeNull] MediaTypeHeaderValue contentType) { Guard.NotNull(content, nameof(content)); var stringContent = new StringContent(content); stringContent.Headers.ContentType = contentType; return stringContent; } } }