public void AppendThrowsWhenHeaderValueContainsNonASCIICharacters()
        {
            var          headers = new FrameRequestHeaders();
            const string key     = "\u00141ód\017c";

            var encoding = Encoding.GetEncoding("iso-8859-1");

            Assert.Throws <BadHttpRequestException>(
                () => headers.Append(encoding.GetBytes(key), 0, encoding.GetByteCount(key), key));
        }
Пример #2
0
        public void AppendThrowsWhenHeaderNameContainsNonASCIICharacters()
        {
            var          headers = new FrameRequestHeaders();
            const string key     = "\u00141\u00F3d\017c";

            var encoding  = Encoding.GetEncoding("iso-8859-1");
            var exception = Assert.Throws <BadHttpRequestException>(
                () => headers.Append(encoding.GetBytes(key), "value"));

            Assert.Equal(StatusCodes.Status400BadRequest, exception.StatusCode);
        }