92 references to ContentDispositionHeaderValue
Microsoft.AspNetCore.Http.Extensions.Tests (1)
HeaderDictionaryTypeExtensionsTest.cs (1)
63var expected = new ContentDispositionHeaderValue("form-data") { Name = "\"fieldName\"" };
Microsoft.AspNetCore.Http.Microbenchmarks (1)
ContentDispositionHeaderValueBenchmarks.cs (1)
11private readonly ContentDispositionHeaderValue _contentDisposition = new ContentDispositionHeaderValue("inline");
Microsoft.AspNetCore.Http.Results (1)
src\Shared\ResultsHelpers\FileResultHelper.cs (1)
352var contentDisposition = new ContentDispositionHeaderValue("attachment");
Microsoft.AspNetCore.Mvc.Core (1)
src\Shared\ResultsHelpers\FileResultHelper.cs (1)
352var contentDisposition = new ContentDispositionHeaderValue("attachment");
Microsoft.AspNetCore.Mvc.Core.Test (1)
FileResultHelperTest.cs (1)
213var cd = new ContentDispositionHeaderValue("attachment");
Microsoft.Net.Http.Headers.Tests (87)
ContentDispositionHeaderValueTest.cs (87)
14Assert.Throws<ArgumentException>(() => new ContentDispositionHeaderValue(null)); 21Assert.Throws<ArgumentException>(() => new ContentDispositionHeaderValue(string.Empty)); 44var contentDisposition = new ContentDispositionHeaderValue("inline"); 58var contentDisposition = new ContentDispositionHeaderValue("inline"); 65var contentDisposition = new ContentDispositionHeaderValue("inline"); 75var contentDisposition = new ContentDispositionHeaderValue("inline"); 90var contentDisposition = new ContentDispositionHeaderValue("inline"); 110var contentDisposition = new ContentDispositionHeaderValue("inline"); 130var contentDisposition = new ContentDispositionHeaderValue("inline"); 145var contentDisposition = new ContentDispositionHeaderValue("inline"); 160var contentDisposition = new ContentDispositionHeaderValue("inline"); 182var contentDisposition = new ContentDispositionHeaderValue("inline"); 204var contentDisposition = new ContentDispositionHeaderValue("inline"); 219var contentDisposition = new ContentDispositionHeaderValue("inline"); 227var contentDisposition = new ContentDispositionHeaderValue("inline"); 235var contentDisposition = new ContentDispositionHeaderValue("inline"); 266var contentDisposition = new ContentDispositionHeaderValue("inline"); 295var contentDisposition = new ContentDispositionHeaderValue("inline"); 307var contentDisposition = new ContentDispositionHeaderValue("inline"); 333var contentDisposition = new ContentDispositionHeaderValue("inline"); 351var contentDisposition = new ContentDispositionHeaderValue("inline"); 372var contentDisposition = new ContentDispositionHeaderValue("inline"); 394var contentDisposition = new ContentDispositionHeaderValue("inline"); 432var contentDisposition1 = new ContentDispositionHeaderValue("inline"); 433var contentDisposition2 = new ContentDispositionHeaderValue("inline"); 435var contentDisposition3 = new ContentDispositionHeaderValue("inline"); 437var contentDisposition4 = new ContentDispositionHeaderValue("INLINE"); 438var contentDisposition5 = new ContentDispositionHeaderValue("INLINE"); 451var contentDisposition1 = new ContentDispositionHeaderValue("inline"); 452var contentDisposition2 = new ContentDispositionHeaderValue("inline"); 454var contentDisposition3 = new ContentDispositionHeaderValue("inline"); 456var contentDisposition4 = new ContentDispositionHeaderValue("INLINE"); 457var contentDisposition5 = new ContentDispositionHeaderValue("INLINE"); 459var contentDisposition6 = new ContentDispositionHeaderValue("INLINE"); 462var contentDisposition7 = new ContentDispositionHeaderValue("attachment"); 478var expected = new ContentDispositionHeaderValue("inline"); 514var expected = new ContentDispositionHeaderValue("inline"); 542{ "inline", new ContentDispositionHeaderValue("inline") }, // @"This should be equivalent to not including the header at all." 543{ "inline;", new ContentDispositionHeaderValue("inline") }, 544{ "inline;name=", new ContentDispositionHeaderValue("inline") { Parameters = { new NameValueHeaderValue("name", "") } } }, // TODO: passing in a null value causes a strange assert on CoreCLR before the test even starts. Not reproducible in the body of a test. 545{ "inline;name=value", new ContentDispositionHeaderValue("inline") { Name = "value" } }, 546{ "inline;name=value;", new ContentDispositionHeaderValue("inline") { Name = "value" } }, 547{ "inline;name=value;", new ContentDispositionHeaderValue("inline") { Name = "value" } }, 548{ @"inline; filename=""foo.html""", new ContentDispositionHeaderValue("inline") { FileName = @"""foo.html""" } }, 549{ @"inline; filename=""Not an attachment!""", new ContentDispositionHeaderValue("inline") { FileName = @"""Not an attachment!""" } }, // 'inline', specifying a filename of Not an attachment! - this checks for proper parsing for disposition types. 550{ @"inline; filename=""foo.pdf""", new ContentDispositionHeaderValue("inline") { FileName = @"""foo.pdf""" } }, 551{ "attachment", new ContentDispositionHeaderValue("attachment") }, 552{ "ATTACHMENT", new ContentDispositionHeaderValue("ATTACHMENT") }, 553{ @"attachment; filename=""foo.html""", new ContentDispositionHeaderValue("attachment") { FileName = @"""foo.html""" } }, 554{ @"attachment; filename=""\""quoting\"" tested.html""", new ContentDispositionHeaderValue("attachment") { FileName = "\"\"quoting\" tested.html\"" } }, // 'attachment', specifying a filename of \"quoting\" tested.html (using double quotes around "quoting" to test... quoting) 555{ @"attachment; filename=""Here's a semicolon;.html""", new ContentDispositionHeaderValue("attachment") { FileName = @"""Here's a semicolon;.html""" } }, // , 'attachment', specifying a filename of Here's a semicolon;.html - this checks for proper parsing for parameters. 556{ @"attachment; foo=""bar""; filename=""foo.html""", new ContentDispositionHeaderValue(@"attachment") { FileName = @"""foo.html""", Parameters = { new NameValueHeaderValue("foo", @"""bar""") } } }, // 'attachment', specifying a filename of foo.html and an extension parameter "foo" which should be ignored (see <a href="http://greenbytes.de/tech/webdav/rfc2183.html#rfc.section.2.8">Section 2.8 of RFC 2183</a>.). 557{ @"attachment; foo=""\""\\"";filename=""foo.html""", new ContentDispositionHeaderValue(@"attachment") { FileName = @"""foo.html""", Parameters = { new NameValueHeaderValue("foo", @"""\""\\""") } } }, // 'attachment', specifying a filename of foo.html and an extension parameter "foo" which should be ignored (see <a href="http://greenbytes.de/tech/webdav/rfc2183.html#rfc.section.2.8">Section 2.8 of RFC 2183</a>.). The extension parameter actually uses backslash-escapes. This tests whether the UA properly skips the parameter. 558{ @"attachment; FILENAME=""foo.html""", new ContentDispositionHeaderValue("attachment") { FileName = @"""foo.html""" } }, 559{ @"attachment; filename=foo.html", new ContentDispositionHeaderValue("attachment") { FileName = "foo.html" } }, // 'attachment', specifying a filename of foo.html using a token instead of a quoted-string. 560{ @"attachment; filename='foo.bar'", new ContentDispositionHeaderValue("attachment") { FileName = "'foo.bar'" } }, // 'attachment', specifying a filename of 'foo.bar' using single quotes. 561{ @"attachment; filename=""foo-ä.html""", new ContentDispositionHeaderValue("attachment" ) { Parameters = { new NameValueHeaderValue("filename", @"""foo-ä.html""") } } }, // 'attachment', specifying a filename of foo-ä.html, using plain ISO-8859-1 562{ @"attachment; filename=""foo-&#xc3;&#xa4;.html""", new ContentDispositionHeaderValue("attachment") { FileName = @"""foo-&#xc3;&#xa4;.html""" } }, // 'attachment', specifying a filename of foo-&#xc3;&#xa4;.html, which happens to be foo-ä.html using UTF-8 encoding. 563{ @"attachment; filename=""foo-%41.html""", new ContentDispositionHeaderValue("attachment") { Parameters = { new NameValueHeaderValue("filename", @"""foo-%41.html""") } } }, 564{ @"attachment; filename=""50%.html""", new ContentDispositionHeaderValue("attachment") { Parameters = { new NameValueHeaderValue("filename", @"""50%.html""") } } }, 565{ @"attachment; filename=""foo-%\41.html""", new ContentDispositionHeaderValue("attachment") { Parameters = { new NameValueHeaderValue("filename", @"""foo-%\41.html""") } } }, // 'attachment', specifying a filename of foo-%41.html, using an escape character (this tests whether adding an escape character inside a %xx sequence can be used to disable the non-conformant %xx-unescaping). 566{ @"attachment; name=""foo-%41.html""", new ContentDispositionHeaderValue("attachment") { Name = @"""foo-%41.html""" } }, // 'attachment', specifying a <i>name</i> parameter of foo-%41.html. (this test was added to observe the behavior of the (unspecified) treatment of ""name"" as synonym for ""filename""; see <a href=""http://www.imc.org/ietf-smtp/mail-archive/msg05023.html"">Ned Freed's summary</a> where this comes from in MIME messages) 567{ @"attachment; filename=""ä-%41.html""", new ContentDispositionHeaderValue("attachment") { Parameters = { new NameValueHeaderValue("filename", @"""ä-%41.html""") } } }, // 'attachment', specifying a filename parameter of ä-%41.html. (this test was added to observe the behavior when non-ASCII characters and percent-hexdig sequences are combined) 568{ @"attachment; filename=""foo-%c3%a4-%e2%82%ac.html""", new ContentDispositionHeaderValue("attachment") { FileName = @"""foo-%c3%a4-%e2%82%ac.html""" } }, // 'attachment', specifying a filename of foo-%c3%a4-%e2%82%ac.html, using raw percent encoded UTF-8 to represent foo-ä-&#x20ac;.html 569{ @"attachment; filename =""foo.html""", new ContentDispositionHeaderValue("attachment") { FileName = @"""foo.html""" } }, 570{ @"attachment; xfilename=foo.html", new ContentDispositionHeaderValue("attachment" ) { Parameters = { new NameValueHeaderValue("xfilename", "foo.html") } } }, 571{ @"attachment; filename=""/foo.html""", new ContentDispositionHeaderValue("attachment") { FileName = @"""/foo.html""" } }, 572{ @"attachment; creation-date=""Wed, 12 Feb 1997 16:29:51 -0500""", new ContentDispositionHeaderValue("attachment") { Parameters = { new NameValueHeaderValue("creation-date", @"""Wed, 12 Feb 1997 16:29:51 -0500""") } } }, 573{ @"attachment; modification-date=""Wed, 12 Feb 1997 16:29:51 -0500""", new ContentDispositionHeaderValue("attachment") { Parameters = { new NameValueHeaderValue("modification-date", @"""Wed, 12 Feb 1997 16:29:51 -0500""") } } }, 574{ @"foobar", new ContentDispositionHeaderValue("foobar") }, // @"This should be equivalent to using ""attachment""." 575{ @"attachment; example=""filename=example.txt""", new ContentDispositionHeaderValue("attachment") { Parameters = { new NameValueHeaderValue("example", @"""filename=example.txt""") } } }, 576{ @"attachment; filename*=iso-8859-1''foo-%E4.html", new ContentDispositionHeaderValue("attachment") { Parameters = { new NameValueHeaderValue("filename*", "iso-8859-1''foo-%E4.html") } } }, // 'attachment', specifying a filename of foo-ä.html, using RFC2231 encoded ISO-8859-1 577{ @"attachment; filename*=UTF-8''foo-%c3%a4-%e2%82%ac.html", new ContentDispositionHeaderValue("attachment") { Parameters = { new NameValueHeaderValue("filename*", "UTF-8''foo-%c3%a4-%e2%82%ac.html") } } }, // 'attachment', specifying a filename of foo-ä-&#x20ac;.html, using RFC2231 encoded UTF-8 578{ @"attachment; filename*=''foo-%c3%a4-%e2%82%ac.html", new ContentDispositionHeaderValue("attachment") { Parameters = { new NameValueHeaderValue("filename*", "''foo-%c3%a4-%e2%82%ac.html") } } }, // Behavior is undefined in RFC 2231, the charset part is missing, although UTF-8 was used. 579{ @"attachment; filename*=UTF-8''foo-a%22.html", new ContentDispositionHeaderValue("attachment") { FileNameStar = @"foo-a"".html" } }, 580{ @"attachment; filename*= UTF-8''foo-%c3%a4.html", new ContentDispositionHeaderValue("attachment") { FileNameStar = "foo-ä.html" } }, 581{ @"attachment; filename* =UTF-8''foo-%c3%a4.html", new ContentDispositionHeaderValue("attachment") { FileNameStar = "foo-ä.html" } }, 582{ @"attachment; filename*=UTF-8''A-%2541.html", new ContentDispositionHeaderValue("attachment") { FileNameStar = "A-%41.html" } }, 583{ @"attachment; filename*=UTF-8''%5cfoo.html", new ContentDispositionHeaderValue("attachment") { FileNameStar = @"\foo.html" } }, 584{ @"attachment; filename=""foo-ae.html""; filename*=UTF-8''foo-%c3%a4.html", new ContentDispositionHeaderValue("attachment") { FileName = @"""foo-ae.html""", FileNameStar = "foo-ä.html" } }, 585{ @"attachment; filename*=UTF-8''foo-%c3%a4.html; filename=""foo-ae.html""", new ContentDispositionHeaderValue("attachment") { FileNameStar = "foo-ä.html", FileName = @"""foo-ae.html""" } }, 586{ @"attachment; foobar=x; filename=""foo.html""", new ContentDispositionHeaderValue("attachment") { FileName = @"""foo.html""", Parameters = { new NameValueHeaderValue("foobar", "x") } } }, 587{ @"attachment; filename=""=?ISO-8859-1?Q?foo-=E4.html?=""", new ContentDispositionHeaderValue("attachment") { FileName = @"""=?ISO-8859-1?Q?foo-=E4.html?=""" } }, // attachment; filename="=?ISO-8859-1?Q?foo-=E4.html?=" 588{ @"attachment; filename=""=?utf-8?B?Zm9vLeQuaHRtbA==?=""", new ContentDispositionHeaderValue("attachment") { FileName = @"""=?utf-8?B?Zm9vLeQuaHRtbA==?=""" } }, // attachment; filename="=?utf-8?B?Zm9vLeQuaHRtbA==?=" 589{ @"attachment; filename=foo.html ;", new ContentDispositionHeaderValue("attachment") { FileName="foo.html" } }, // 'attachment', specifying a filename of foo.html using a token instead of a quoted-string, and adding a trailing semicolon., 655var contentDisposition = new ContentDispositionHeaderValue("attachment"); 704Assert.Throws<FormatException>(() => new ContentDispositionHeaderValue(contentDisposition));