Ejemplo n.º 1
0
        public void test_head_object()
        {
            _headers.Add("request-type", "object");
            ObjectResponse res = _client.HeadObject("", "", "", "", _headers, new Dictionary <string, string>());

            Assert.True(res.Headers.ContainsKey("content-length"));
            Assert.True(res.Headers["content-length"] == "1");
            Assert.True(res.Headers.ContainsKey("content-type"));
            Assert.True(res.Headers["content-type"] == "foo/foobar");
            Assert.True(res.Headers.ContainsKey("x-object-meta-foo"));
            Assert.True(res.Headers["x-object-meta-foo"] == "foo");
            Assert.True(res.Headers.ContainsKey("etag"));
            Assert.True(res.Headers["etag"] == "foo");
            Assert.True(res.Reason == "foo");
            Assert.True(res.Status == 201);
        }
Ejemplo n.º 2
0
        public void test_head_object()
        {
            string name = prefix + Guid.NewGuid().ToString();

            created_containers.Add(name);
            var obj_cont_pair = new Dictionary <string, string> {
                { "container", name }, { "object", name }
            };

            client.PutContainer(storage_url, auth_token, name, new Dictionary <string, string>(), new Dictionary <string, string>());
            created_objects.Add(obj_cont_pair);
            var encoder = new UTF8Encoding();

            byte[] byte_array = encoder.GetBytes(object_content);
            var    stream     = new MemoryStream(byte_array);

            client.PutObject(storage_url, auth_token, name, name, stream, new Dictionary <string, string>(), new Dictionary <string, string>());
            var res = client.HeadObject(storage_url, auth_token, name, name, new Dictionary <string, string>(), new Dictionary <string, string>());

            foreach (string header in object_header_keys)
            {
                Assert.IsTrue(res.Headers.ContainsKey(header));
            }
        }