convert c# code to haxe - "using Rx.Http.Extensions;
using Rx.Http.Interceptors;
using Rx.Http.Logging;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Web;

namespace Rx.Http
{
    public class RxHttpClient : IDisposable
    {
        public static RxHttpClient Create() => new RxHttpClient(new HttpClient(), null);

        private readonly HttpClient httpClient;
        private RxHttpLogger logger;

        public List<RxRequestInterceptor> RequestInterceptors { get; private set; }
        public List<RxResponseInterceptor> ResponseInterceptors { get; private set; }

        public RxHttpClient(HttpClient httpClient, RxHttpLogger logger)
        {
            this.httpClient = httpClient;
            this.logger = logger;
            this.RequestInterceptors = new List<RxRequestInterceptor>();
            this.ResponseInterceptors = new List<RxResponseInterceptor>();
        }

        public RxHttpClient UseLogger(RxHttpLogger logger)
        {
            this.logger = logger;
            return this;
        }

        public IObservable<RxHttpResponse> Get(string url)
        {
            return Request(url, HttpMethod.Get);
        }

        public IObservable<RxHttpResponse> Get(string url, object content)
        {
            return Request(url, content, HttpMethod.Get);
        }
        public IObservable<RxHttpResponse> Request(string url, object obj, Action<RxHttpRequestOptions> options, HttpMethod method)
        {
            return Request(new RxHttpRequest(url, RequestInterceptors, ResponseInterceptors, obj, options), method);
        }

        public IObservable<RxHttpResponse> Request(string url, object obj, HttpMethod method)
        {
            return Request(new RxHttpRequest(url, RequestInterceptors, ResponseInterceptors, obj), method);
        }

        private IObservable<RxHttpResponse> Request(RxHttpRequest httpRequest, HttpMethod method)
        {
            return SingleObservable.Create(async () =>
            {
                var requestId = Guid.NewGuid();
                httpRequest.RequestInterceptors.ForEach(interceptor => interceptor.Intercept(httpRequest));
                var message = BuildRequestMessage(httpRequest, method);
                var url = message.RequestUri.AbsoluteUri;
                logger?.OnSend(message, requestId);
                var response = await httpClient.SendAsync(message);
                logger?.OnReceive(response, url, message.Method, requestId);
                httpRequest.ResponseInterceptors.ForEach(interceptor => interceptor.Intercept(response));
                return new RxHttpResponse(response, httpRequest);
            });
        }


        public IObservable<T> Request<T>(RxHttpRequest httpRequest, HttpMethod method)
        {
            return Request(httpRequest, method)
                .Content<T>();
        }

        private string BuildUrl(RxHttpRequest request)
        {
            var builder = new UriBuilder((httpClient.BaseAddress?.AbsoluteUri ?? string.Empty) + request.Url);

            var query = HttpUtility.ParseQueryString(builder.Query);

            foreach (var entry in request.QueryStrings)
            {
                foreach(var param in entry.Value)
                {
                    query.Add(entry.Key, param);
                }
            }

            builder.Query = query.ToString();
            return builder.Uri.AbsoluteUri;
        }

        private HttpRequestMessage BuildRequestMessage(RxHttpRequest request, HttpMethod method)
        {
            var url = BuildUrl(request);
            var content = request.BuildContent();
            var requestMessage = new HttpRequestMessage(method, url);
            requestMessage.Content = content;
            requestMessage.Headers.Clear();
            foreach (var pair in request.Headers)
            {
                requestMessage.Headers.Add(pair.Key, pair.Value);
            }

            return requestMessage;
        }

        public void Dispose()
        {
            httpClient.Dispose();
        }
    }
}"