<commit_before>﻿using MpzMail.Api.Contract;
using MpzMail.Api.Model;
using System;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

namespace MpzMail.Api
{
    public class DefaultHttpClient : IHttpClient
    {
        public HttpResult Request(string url, string xml)
        {
            using (var httpClient = new HttpClient())
            {
                httpClient.Timeout = new TimeSpan(0, 30, 0);
                var httpContent = new StringContent(xml, Encoding.UTF8, "application/xml");
                try
                {
                    var task = Task.Run(() => httpClient.PostAsync(url, httpContent)); 
                    task.Wait();
                    if (task.IsCanceled || task.IsFaulted)
                    {<commit_msg>Httpclient optimize<commit_after>﻿using MpzMail.Api.Contract;
using MpzMail.Api.Model;
using System;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

namespace MpzMail.Api
{
    public class DefaultHttpClient : IHttpClient
    {
        private readonly int _timeout;
        public DefaultHttpClient(int timeoutInSeconds = 300)
        {
            this._timeout = timeoutInSeconds;
        }

        public HttpResult Request(string url, string xml)
        {
            using (var httpClient = new HttpClient())
            {
                httpClient.Timeout = new TimeSpan(0, 0, this._timeout);
                var httpContent = new StringContent(xml, Encoding.UTF8, "application/xml");
                try
                {
                    var task = Task.Run(() => httpClient.PostAsync(url, httpContent)); 
                    task.Wait();
                    if (task.IsCanceled || task.IsFaulted)
                    {
{'fraction_non_alphanumeric': 0.09265536723163842, 'fraction_numerical': 0.0062146892655367235, 'mean_word_length': 1.8703403565640195, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2864055', 'n_tokens_mistral': 492, 'n_tokens_neox': 468, 'n_words': 115}