コード例 #1
0
        public V3SourceRepository(PackageSource source, string host)
        {
            _source = source;
            _root   = new Uri(source.Url);

            // TODO: Get context from current UI activity (PowerShell, Dialog, etc.)
            _userAgent = UserAgentUtil.GetUserAgent("NuGet.Client", host);

            _http = new System.Net.Http.HttpClient(
                new TracingHttpHandler(
                    NuGetTraceSources.V3SourceRepository,
                    new SetUserAgentHandler(
                        _userAgent,
                        new HttpClientHandler())));

            // Check if we should disable the browser file cache
            FileCacheBase cache = new BrowserFileCache();

            if (String.Equals(Environment.GetEnvironmentVariable("NUGET_DISABLE_IE_CACHE"), "true", StringComparison.OrdinalIgnoreCase))
            {
                cache = new NullFileCache();
            }

            cache = new NullFileCache(); // +++ Disable caching for testing

            _client = new DataClient(
                _http,
                cache);
        }
コード例 #2
0
        public V3SourceRepository(PackageSource source, string host)
        {
            _source = source;
            _root = new Uri(source.Url);

            // TODO: Get context from current UI activity (PowerShell, Dialog, etc.)
            _userAgent = UserAgentUtil.GetUserAgent("NuGet.Client", host);

            _http = new System.Net.Http.HttpClient(
                new TracingHttpHandler(
                    NuGetTraceSources.V3SourceRepository,
                    new SetUserAgentHandler(
                        _userAgent,
                        new HttpClientHandler())));

            // Check if we should disable the browser file cache
            FileCacheBase cache = new BrowserFileCache();
            if (String.Equals(Environment.GetEnvironmentVariable("NUGET_DISABLE_IE_CACHE"), "true", StringComparison.OrdinalIgnoreCase))
            {
                cache = new NullFileCache();
            }

            cache = new NullFileCache(); // +++ Disable caching for testing

            _client = new DataClient(
                _http,
                cache);
        }