Пример #1
0
        public BatchDeleteRequest(AwsRegion region, string bucketName, DeleteBatch batch)
            : base(HttpMethod.Post, region, bucketName, "?delete")
        {
            var xmlText = batch.ToXmlString();

            Content = new StringContent(xmlText, Encoding.UTF8, "text/xml");

            Content.Headers.ContentMD5 = MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(xmlText));

            CompletionOption = HttpCompletionOption.ResponseContentRead;
        }
        public DeleteObjectBatchRequest(string host, string bucketName, DeleteBatch batch)
            : base(HttpMethod.Post, host, bucketName, null, "?delete")
        {
            string xmlText = batch.ToXmlString();

            byte[] data = Encoding.UTF8.GetBytes(xmlText);

            Content = new ByteArrayContent(data)
            {
                Headers = { { "Content-Type", "text/xml" } }
            };

            using MD5 md5 = MD5.Create();

            Content.Headers.ContentMD5 = md5.ComputeHash(data);

            CompletionOption = HttpCompletionOption.ResponseContentRead;
        }
Пример #3
0
        public BatchDeleteRequest(string host, string bucketName, DeleteBatch batch)
            : base(HttpMethod.Post, host, bucketName, "?delete")
        {
            #region Preconditions

            if (batch == null)
            {
                throw new ArgumentNullException(nameof(batch));
            }

            #endregion

            var xmlText = batch.ToXmlString();

            Content = new StringContent(xmlText, Encoding.UTF8, "text/xml");

            Content.Headers.ContentMD5 = MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(xmlText));

            CompletionOption = HttpCompletionOption.ResponseContentRead;
        }