Exemplo n.º 1
0
        //---------------------------------------------------------------------
        public BatchResponse SendAndVerify(params AstoriaRequest[] requests)
        {
            // Populate batch.
            BatchChangeset cs = base.GetChangeset();

            foreach (var r in requests)
            {
                if (r == null) // Begin new changeset.
                {
                    cs = base.GetChangeset();
                }
                else
                {
                    // Expect no dummy etags from stream provider for batched requests.
                    r.ETagHeaderExpected = false;

                    if (r.Verb == RequestVerb.Get)  // Add request to batch.
                    {
                        r.ContentType = null;
                        base.Add(r, true);
                    }
                    else // Add request to current changeset.
                    {
                        if (r.Verb == RequestVerb.Delete)
                        {
                            r.ContentType = null;
                        }
                        cs.Add(r, true);
                    }
                }
            }

            // Send and verify batch request. SendAndVerify() logic not applied.
            BatchResponse response = base.GetResponse() as BatchResponse;

            response.Verify();
            return(response);
        }