Microsoft.Protocols.TestSuites.MS_OXORULE.NspiMapiHttpAdapter.SendAddressBookRequest C# (CSharp) Method

SendAddressBookRequest() private method

Send the request to address book server endpoint.
private SendAddressBookRequest ( IRequestBody requestBody, RequestType requestType, bool cookieChange = true ) : ChunkedResponse
requestBody IRequestBody The request body.
requestType RequestType The type of the request.
cookieChange bool Whether the session context cookie is changed.
return Microsoft.Protocols.TestSuites.Common.ChunkedResponse
        private ChunkedResponse SendAddressBookRequest(IRequestBody requestBody, RequestType requestType, bool cookieChange = true)
        {
            byte[] rawBuffer = null;
            ChunkedResponse chunkedResponse = null;

            // Send the execute HTTP request and get the response
            HttpWebResponse response = MapiHttpAdapter.SendMAPIHttpRequest(this.site, this.addressBookUrl, this.userName, this.domainName, this.password, requestBody, requestType.ToString(), AdapterHelper.SessionContextCookies);
            rawBuffer = MapiHttpAdapter.ReadHttpResponse(response);
            string responseCode = response.Headers["X-ResponseCode"];
            this.site.Assert.AreEqual<uint>(0, uint.Parse(responseCode), "The request to the address book server should be executed successfully!");

            // Read the HTTP response buffer and parse the response to correct format
            chunkedResponse = ChunkedResponse.ParseChunkedResponse(rawBuffer);

            response.GetResponseStream().Close();
            if (cookieChange)
            {
                AdapterHelper.SessionContextCookies = response.Cookies;
            }

            return chunkedResponse;
        }