Microsoft.Protocols.TestSuites.MS_OXCMAPIHTTP.MS_OXCMAPIHTTPAdapter.VerifyContentTypeHeader C# (CSharp) Method

VerifyContentTypeHeader() private method

Verify the requirements related to Content-Type header.
private VerifyContentTypeHeader ( WebHeaderCollection headers ) : void
headers System.Net.WebHeaderCollection The collection of HTTP headers.
return void
        private void VerifyContentTypeHeader(WebHeaderCollection headers)
        {
            string contentType = headers["Content-Type"];
            int responseCodeValue;
            int.TryParse(headers["X-ResponseCode"], out responseCodeValue);
            if (responseCodeValue == 0)
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R2037");

                // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R2037
                this.Site.CaptureRequirementIfAreEqual<string>(
                    "application/mapi-http",
                    contentType,
                    2037,
                    @"[In Content-Type Header Field] The Content-Type header MUST contain the string ""application/mapi-http"" on responses with X-ResponseCode header of 0.");
            }
            else
            {
                // Add the debug information
                this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMAPIHTTP_R2038");

                // Verify MS-OXCMAPIHTTP requirement: MS-OXCMAPIHTTP_R2038
                this.Site.CaptureRequirementIfAreEqual<string>(
                    "text/html",
                    contentType,
                    2038,
                    @"[In Content-Type Header Field] If X-ResponseCode is non-zero, the Content-Type header MUST contain the string ""text/html"".");
            }
        }
MS_OXCMAPIHTTPAdapter