/// <summary>
        /// Initializes a new instance of the <see cref="TinyRestClient"/> class.
        /// </summary>
        /// <param name="httpClient">The httpclient used</param>
        /// <param name="serverAddress">The server address.</param>
        public TinyRestClient(HttpClient httpClient, string serverAddress)
        {
            _serverAddress = serverAddress ?? throw new ArgumentNullException(nameof(serverAddress));
            _httpClient    = httpClient ?? throw new ArgumentNullException(nameof(httpClient));
            if (!_serverAddress.EndsWith("/"))
            {
                _serverAddress += "/";
            }

            Settings = new RestClientSettings();
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TinyRestClient"/> class.
        /// </summary>
        /// <param name="httpClient">The httpclient used.</param>
        /// <param name="serverAddress">The server address.</param>
        public TinyRestClient(HttpClient httpClient, string serverAddress)
        {
            _serverAddress = serverAddress ?? throw new ArgumentNullException(nameof(serverAddress));
            _httpClient    = httpClient ?? throw new ArgumentNullException(nameof(httpClient));

            // We manage it in by our own settings
            if (httpClient.Timeout != Timeout.InfiniteTimeSpan)
            {
                httpClient.Timeout = Timeout.InfiniteTimeSpan;
            }

            if (!_serverAddress.EndsWith("/"))
            {
                _serverAddress += "/";
            }

            Settings = new RestClientSettings();
        }