public void GetLargeChunkedCookie_Reassembled() { HttpContext context = new DefaultHttpContext(); context.Request.Headers.AppendValues("Cookie", "TestCookie=chunks:7", "TestCookieC1=abcdefghi", "TestCookieC2=jklmnopqr", "TestCookieC3=stuvwxyz0", "TestCookieC4=123456789", "TestCookieC5=ABCDEFGHI", "TestCookieC6=JKLMNOPQR", "TestCookieC7=STUVWXYZ"); string result = new ChunkingCookieManager().GetRequestCookie(context, "TestCookie"); string testString = "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; Assert.Equal(testString, result); }
public void GetLargeChunkedCookieWithQuotes_Reassembled() { HttpContext context = new DefaultHttpContext(); context.Request.Headers.AppendValues("Cookie", "TestCookie=chunks:7", "TestCookieC1=\"abcdefghi\"", "TestCookieC2=\"jklmnopqr\"", "TestCookieC3=\"stuvwxyz0\"", "TestCookieC4=\"123456789\"", "TestCookieC5=\"ABCDEFGHI\"", "TestCookieC6=\"JKLMNOPQR\"", "TestCookieC7=\"STUVWXYZ\""); string result = new ChunkingCookieManager().GetRequestCookie(context, "TestCookie"); string testString = "\"abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\""; Assert.Equal(testString, result); }
public void GetLargeChunkedCookieWithMissingChunk_ThrowingDisabled_NotReassembled() { HttpContext context = new DefaultHttpContext(); context.Request.Headers.AppendValues("Cookie", "TestCookie=chunks:7", "TestCookieC1=abcdefghi", // Missing chunk "TestCookieC2=jklmnopqr", "TestCookieC3=stuvwxyz0", "TestCookieC4=123456789", "TestCookieC5=ABCDEFGHI", "TestCookieC6=JKLMNOPQR", "TestCookieC7=STUVWXYZ"); string result = new ChunkingCookieManager() { ThrowForPartialCookies = false }.GetRequestCookie(context, "TestCookie"); string testString = "chunks:7"; Assert.Equal(testString, result); }