コード例 #1
0
ファイル: CouchApi.cs プロジェクト: artikh/CouchDude
		/// <constructor />
		public CouchApi(CouchApiSettings settings, HttpMessageHandler messageHandler = null)
			: base(messageHandler ?? new HttpClientHandler())
		{
			Settings = settings;

			uriConstructor = new UriConstructor(settings.ServerUri);
			synchronousCouchApi = new SynchronousCouchApi(this);
			replicatorApi = new ReplicatorApi(this);

			BaseAddress = settings.ServerUri;
			DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(MediaType.Json));
			DefaultRequestHeaders.AcceptEncoding.Add(new StringWithQualityHeaderValue("gzip"));
			DefaultRequestHeaders.AcceptEncoding.Add(new StringWithQualityHeaderValue("deflate"));
			if (settings.Credentials != null)
				DefaultRequestHeaders.Authorization = settings.Credentials.ToAuthenticationHeader();
		}
コード例 #2
0
        /// <constructor />
        public CouchApi(CouchApiSettings settings, HttpMessageHandler messageHandler = null)
            : base(messageHandler ?? new HttpClientHandler())
        {
            Settings = settings;

            uriConstructor      = new UriConstructor(settings.ServerUri);
            synchronousCouchApi = new SynchronousCouchApi(this);
            replicatorApi       = new ReplicatorApi(this);

            BaseAddress = settings.ServerUri;
            DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(MediaType.Json));
            DefaultRequestHeaders.AcceptEncoding.Add(new StringWithQualityHeaderValue("gzip"));
            DefaultRequestHeaders.AcceptEncoding.Add(new StringWithQualityHeaderValue("deflate"));
            if (settings.Credentials != null)
            {
                DefaultRequestHeaders.Authorization = settings.Credentials.ToAuthenticationHeader();
            }
        }