tests/NuGetGallery.FunctionalTests/ErrorHandling/ErrorHandlingTests.cs
/// <summary>
/// Verify the behavior when a corrupted cookie is sent back to the server.
/// </summary>
Verify the behavior when a corrupted cookie is sent back to the server.
Verify the behavior when a corrupted cookie is sent back to the server .
[Theory]
        [Priority(2)]
        [Category("P2Tests")]
        [InlineData("/", "__Controller::TempData", "Message=You successfully uploaded z̡̜͍̈̍̐̃̊͋́a̜̣͍̬̞̝͉̽ͧ͗l̸̖͕̤̠̹̘͖̃̌ͤg͓̝͓̰̀ͪo͈͌ 1.0.0.", 400, false)]
        [InlineData("/", "__Controller::TempData", "Message=<script>alert(1)</script>", 400, false)]
        [InlineData("/", "__Controller::TempData", "<script>alert(1)</script>", 400, false)]
        [InlineData("/packages", "nugetab", "<script>alert(1)</script>", 400, true)]
        [InlineData("/packages", "nugetab", "z̡̜͍̈̍̐̃̊͋́a̜̣͍̬̞̝͉̽ͧ͗l̸̖͕̤̠̹̘͖̃̌ͤg͓̝͓̰̀ͪo͈͌", 400, false)]
        public async Task RejectedCookie(string relativePath, string name, string value, int statusCode, bool pretty)
        {
            _httpClientHandler.UseCookies = false;
            var requestUri = GetRequestUri(relativePath);
            using (var request = new HttpRequestMessage(HttpMethod.Get, requestUri))
            {
                request.Headers.TryAddWithoutValidation("Cookie", $"{name}={value}");
                var response = await GetTestResponseAsync(relativePath, request);
                if (pretty)
                {
                    Validator.PrettyHtml((HttpStatusCode)statusCode)(response);
                }
                else
                {
                    Validator.SimpleHtml((HttpStatusCode)statusCode)(response);
                }
            }
        }
[ Theory ] [ Priority ( 2 ) ] [ Category ( " " ) ] [ InlineData ( " " , " " , " [ InlineData ( " " , " " , " " , 400 , false ) ] [ InlineData ( " " , " " , " " , 400 , false ) ] [ InlineData ( " " , " " , " " , 400 , true ) ] [ InlineData ( " " , " " , " public async Task RejectedCookie ( string relativePath , string name , string value , int statusCode , bool pretty ) { _httpClientHandler . UseCookies = false ; var requestUri = GetRequestUri ( relativePath ) ; using ( var request = new HttpRequestMessage ( HttpMethod . Get , requestUri ) ) { request . Headers . TryAddWithoutValidation ( " " , $" { name } = { value } " ) ; var response = await GetTestResponseAsync ( relativePath , request ) ; if ( pretty ) { Validator . PrettyHtml ( ( HttpStatusCode ) statusCode ) ( response ) ; } else { Validator . SimpleHtml ( ( HttpStatusCode ) statusCode ) ( response ) ; } } }
Verify the behavior when a corrupted cookie is sent back to the server.
Verify the behavior when a corrupted cookie is sent back to the server .
// Arrange // Act // Assert
relativePath
string
name
string
value
string
statusCode
int
pretty
bool