internal static void AttachObjectContent <TInput>(this HttpRequestMessage requestMessage, TInput input, MediaFormat mediaFormat) { if (requestMessage == null) { throw new NullReferenceException( $"{nameof(HttpResponseMessage)} is null, could not attach a Mediatype."); } requestMessage.Content = new ObjectContent(typeof(TInput), input, mediaFormat.MediaTypeFormatter()); }