コード例 #1
0
        protected override Task <HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
        {
            // Validate parameters.
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            // Get the current config.
            JiraClientConfiguration config = _jiraClientConfigurationOptions.Value;

            // Set the username and password on the request.
            request.SetBasicHttpAuthentication(config.Username, config.Password);

            // Send the request.
            return(base.SendAsync(request, cancellationToken));
        }
コード例 #2
0
        internal static string CreateApiUri(
            this JiraClientConfiguration configuration,
            string path
            )
        {
            // Validate parameters.
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }
            if (string.IsNullOrWhiteSpace(path))
            {
                throw new ArgumentNullException(nameof(path));
            }

            // Construct the URL. Get the base first.
            string?url = configuration.BaseUrl?.ToString();

            // Combine.
            url = CombineUrls(url, ApiAbsolutePathBase);

            // Combine with the path passed in.
            return(CombineUrls(url, path));
        }