public void write_a_header_that_allows_multiple_values()
        {
            var settings    = new OwinHeaderSettings();
            var environment = new Dictionary <string, object>
            {
                { OwinConstants.HeaderSettings, settings }
            };
            var response = new OwinHttpResponse(environment);

            response.AppendHeader(HttpGeneralHeaders.Allow, "application/json");
            response.AppendHeader(HttpGeneralHeaders.Allow, "text/json");

            var headers = environment.Get <IDictionary <string, string[]> >(OwinConstants.ResponseHeadersKey);

            headers[HttpGeneralHeaders.Allow].ShouldHaveTheSameElementsAs("application/json", "text/json");
        }
        public void write_a_header_that_does_not_allow_multiple_values()
        {
            var settings    = new OwinHeaderSettings();
            var environment = new Dictionary <string, object>
            {
                { OwinConstants.HeaderSettings, settings }
            };
            var response = new OwinHttpResponse(environment);

            settings.DoNotAllowMultipleValues(HttpRequestHeaders.ContentLength);

            response.AppendHeader(HttpRequestHeaders.ContentLength, "1234");
            response.AppendHeader(HttpRequestHeaders.ContentLength, "1234");

            var headers = environment.Get <IDictionary <string, string[]> >(OwinConstants.ResponseHeadersKey);

            headers[HttpRequestHeaders.ContentLength].ShouldHaveTheSameElementsAs("1234");
        }
示例#3
0
 public void SetUp()
 {
     theSettings = new OwinHeaderSettings();
 }