protected override IHttpResponseAbstraction HandlePut() { var containerName = GetContainerName(this.Uri.Segments); var objectName = GetObjectName(this.Uri.Segments); if (containerName == null && objectName == null) { return(TestHelper.CreateErrorResponse()); } if (objectName != null) { var obj = new StorageItem(objectName); obj.ProcessMetaDataFromHeaders(this.Headers); obj.LoadContent(this.Content); this.Objects[obj.Name] = obj; var headers = GenerateObjectResponseHeaders(obj); return(TestHelper.CreateResponse(HttpStatusCode.Created, headers)); } else { var container = new StorageItem(containerName); container.ProcessMetaDataFromHeaders(this.Headers); var containerUpdated = this.Containers.Keys.Any(k => String.Equals(k, container.Name, StringComparison.InvariantCultureIgnoreCase)); this.Containers[container.Name] = container; return(TestHelper.CreateResponse(containerUpdated ? HttpStatusCode.Accepted : HttpStatusCode.Created)); } }
protected override IHttpResponseAbstraction HandlePut() { var containerName = GetContainerName(this.Uri.Segments); var objectName = GetObjectName(this.Uri.Segments); if (containerName == null && objectName == null) { return TestHelper.CreateErrorResponse(); } if (objectName != null) { var obj = new StorageItem(objectName); obj.ProcessMetaDataFromHeaders(this.Headers); obj.LoadContent(this.Content); this.Objects[obj.Name] = obj; var headers = GenerateObjectResponseHeaders(obj); return TestHelper.CreateResponse(HttpStatusCode.Created, headers); } else { var container = new StorageItem(containerName); container.ProcessMetaDataFromHeaders(this.Headers); var containerUpdated = this.Containers.Keys.Any(k => String.Equals(k, container.Name, StringComparison.InvariantCultureIgnoreCase)); this.Containers[container.Name] = container; return TestHelper.CreateResponse(containerUpdated ? HttpStatusCode.Accepted : HttpStatusCode.Created); } }