예제 #1
0
        public void Start()
        {
            var requestMessage = CreateConcreteRequest();

            if (!requestMessage.Headers.Contains("User-Agent"))
            {
                requestMessage.Headers.TryAddWithoutValidation("User-Agent", String.Format("CouchbaseLite/{0} ({1})", Replication.SyncProtocolVersion, Manager.VersionString));
            }

            requestMessage.Headers.Add("Accept", "multipart/related, application/json");
            foreach (string requestHeaderKey in _requestHeaders.Keys)
            {
                requestMessage.Headers.TryAddWithoutValidation(requestHeaderKey, _requestHeaders[requestHeaderKey].ToString());
            }

            SetBody(requestMessage);

            ExecuteRequest(_httpClient, requestMessage).ContinueWith(t =>
            {
                Log.To.Sync.V(Tag, "RemoteRequest run() finished, url: {0}", _bulkGetUri);
                if (_httpClient != null)
                {
                    _httpClient.Dispose();
                }

                requestMessage.Dispose();
            });
        }