142 references to NameValueHeaderValue
Microsoft.Net.Http.Headers (7)
ContentDispositionHeaderValue.cs (3)
191Parameters.Add(new NameValueHeaderValue(SizeString, sizeString)); 394Parameters.Add(new NameValueHeaderValue(parameter, dateString)); 459Parameters.Add(new NameValueHeaderValue(parameter, processedValue));
HeaderUtilities.cs (1)
43parameters.Add(new NameValueHeaderValue(QualityName, qualityString));
MediaTypeHeaderValue.cs (2)
100Parameters.Add(new NameValueHeaderValue(CharsetString, value)); 174Parameters.Add(new NameValueHeaderValue(BoundaryString, value));
NameValueHeaderValue.cs (1)
39: this(name, null)
Microsoft.Net.Http.Headers.Tests (135)
CacheControlHeaderValueTest.cs (12)
62cacheControl.Extensions.Add(new NameValueHeaderValue("name", "value")); 64Assert.Equal(new NameValueHeaderValue("name", "value"), cacheControl.Extensions.First()); 98cacheControl.Extensions.Add(new NameValueHeaderValue("customName", "customValue")); 237cacheControl5.Extensions.Add(new NameValueHeaderValue("customN", "customV")); 241cacheControl4.Extensions.Add(new NameValueHeaderValue("customN", "customV")); 367cacheControl6.Extensions.Add(new NameValueHeaderValue("customN", "customV")); 371cacheControl5.Extensions.Add(new NameValueHeaderValue("customN", "customV")); 407expected.Extensions.Add(new NameValueHeaderValue("c", "d")); 408expected.Extensions.Add(new NameValueHeaderValue("a", "b")); 418expected.Extensions.Add(new NameValueHeaderValue("custom", "")); 496expected.Extensions.Add(new NameValueHeaderValue("custom", "")); 533expected.Extensions.Add(new NameValueHeaderValue("custom", ""));
ContentDispositionHeaderValueTest.cs (33)
93NameValueHeaderValue name = new NameValueHeaderValue("NAME", "old_name"); 113var fileName = new NameValueHeaderValue("FILENAME", "old_name"); 163var fileName = new NameValueHeaderValue("FILENAME", "\"=?utf-99?Q?R=mlsZcODTmFtZS5iYXQ=?=\""); 185var fileNameStar = new NameValueHeaderValue("FILENAME*", "old_name"); 269var fileNameStar = new NameValueHeaderValue("FILENAME*", "utf-99'lang'File%CZName.bat"); 310var dateParameter = new NameValueHeaderValue("Creation-DATE", validDateString); 336var dateParameter = new NameValueHeaderValue("read-DATE", invalidDateString); 354var sizeParameter = new NameValueHeaderValue("SIZE", "279172874239"); 375var sizeParameter = new NameValueHeaderValue("SIZE", "-279172874239"); 407contentDisposition.Parameters.Add(new NameValueHeaderValue("custom", "\"custom value\"")); 436contentDisposition3.Parameters.Add(new NameValueHeaderValue("name", "value")); 439contentDisposition5.Parameters.Add(new NameValueHeaderValue("NAME", "MYNAME")); 455contentDisposition3.Parameters.Add(new NameValueHeaderValue("name", "value")); 458contentDisposition5.Parameters.Add(new NameValueHeaderValue("NAME", "MYNAME")); 460contentDisposition6.Parameters.Add(new NameValueHeaderValue("NAME", "MYNAME")); 461contentDisposition6.Parameters.Add(new NameValueHeaderValue("custom", "value")); 492expected.Parameters.Add(new NameValueHeaderValue("filename*", "UTF-8''foo-%c3%a4.html")); 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. 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. 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 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). 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) 570{ @"attachment; xfilename=foo.html", new ContentDispositionHeaderValue("attachment" ) { Parameters = { new NameValueHeaderValue("xfilename", "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""") } } }, 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. 586{ @"attachment; foobar=x; filename=""foo.html""", new ContentDispositionHeaderValue("attachment") { FileName = @"""foo.html""", Parameters = { new NameValueHeaderValue("foobar", "x") } } },
MediaTypeHeaderValueTest.cs (20)
156mediaType0.Parameters.Add(new NameValueHeaderValue("name", "value")); 173mediaType0.Parameters.Add(new NameValueHeaderValue("name", "value")); 201mediaType0.Parameters.Add(new NameValueHeaderValue("name", "value")); 251var charset = new NameValueHeaderValue("CHARSET", "old_charset"); 286var quality = new NameValueHeaderValue("q", "0.132"); 306var quality = new NameValueHeaderValue("Q", "0.132"); 335mediaType.Parameters.Add(new NameValueHeaderValue("custom", "\"custom value\"")); 349mediaType3.Parameters.Add(new NameValueHeaderValue("name", "value")); 352mediaType5.Parameters.Add(new NameValueHeaderValue("CHARSET", "UTF-8")); 368mediaType3.Parameters.Add(new NameValueHeaderValue("name", "value")); 371mediaType5.Parameters.Add(new NameValueHeaderValue("CHARSET", "UTF-8")); 373mediaType6.Parameters.Add(new NameValueHeaderValue("CHARSET", "UTF-8")); 374mediaType6.Parameters.Add(new NameValueHeaderValue("custom", "value")); 400expected.Parameters.Add(new NameValueHeaderValue("custom", "value")); 408expected.Parameters.Add(new NameValueHeaderValue("custom", "\"x\"")); 412expected.Parameters.Add(new NameValueHeaderValue("custom", "\"x\"")); 419expected.Parameters.Add(new NameValueHeaderValue("name", "")); 423expected.Parameters.Add(new NameValueHeaderValue("name", "value")); 441expected.Parameters.Add(new NameValueHeaderValue("foo", "bar")); 447expected.Parameters.Add(new NameValueHeaderValue("foo", "bar"));
NameValueHeaderValueTest.cs (70)
31var nameValue = new NameValueHeaderValue("text", null); 95var pair0 = new NameValueHeaderValue("name", "value"); 110var pair0 = new NameValueHeaderValue("name", "value"); 128var pair0 = new NameValueHeaderValue("name", "value"); 152var nameValue = new NameValueHeaderValue("text", "token"); 268CheckValidParse(" name = value ", new NameValueHeaderValue("name", "value")); 271CheckValidParse(" name=\"value\"", new NameValueHeaderValue("name", "\"value\"")); 272CheckValidParse("name=value", new NameValueHeaderValue("name", "value")); 273CheckValidParse("name=\"quoted str\"", new NameValueHeaderValue("name", "\"quoted str\"")); 274CheckValidParse("name\t =va1ue", new NameValueHeaderValue("name", "va1ue")); 275CheckValidParse("name= va*ue ", new NameValueHeaderValue("name", "va*ue")); 276CheckValidParse("name=", new NameValueHeaderValue("name", "")); 303CheckValidTryParse(" name = value ", new NameValueHeaderValue("name", "value")); 305CheckValidTryParse(" name=\"value\"", new NameValueHeaderValue("name", "\"value\"")); 306CheckValidTryParse("name=value", new NameValueHeaderValue("name", "value")); 348new NameValueHeaderValue("name", "value1"), 349new NameValueHeaderValue("name", "value2"), 350new NameValueHeaderValue("name", "value3"), 351new NameValueHeaderValue("name", "\"value 4\""), 352new NameValueHeaderValue("name", "\"value会5\""), 353new NameValueHeaderValue("name", "value6"), 354new NameValueHeaderValue("name", "value7"), 355new NameValueHeaderValue("name", "\"value 8\""), 356new NameValueHeaderValue("name", "\"value 9\""), 381new NameValueHeaderValue("name", "value1"), 382new NameValueHeaderValue("name", "value2"), 383new NameValueHeaderValue("name", "value3"), 384new NameValueHeaderValue("name", "\"value 4\""), 385new NameValueHeaderValue("name", "\"value会5\""), 386new NameValueHeaderValue("name", "value6"), 387new NameValueHeaderValue("name", "value7"), 388new NameValueHeaderValue("name", "\"value 8\""), 389new NameValueHeaderValue("name", "\"value 9\""), 414new NameValueHeaderValue("name", "value1"), 415new NameValueHeaderValue("name", "value2"), 416new NameValueHeaderValue("name", "value3"), 417new NameValueHeaderValue("name", "\"value 4\""), 418new NameValueHeaderValue("name", "\"value会5\""), 419new NameValueHeaderValue("name", "value6"), 420new NameValueHeaderValue("name", "value7"), 421new NameValueHeaderValue("name", "\"value 8\""), 422new NameValueHeaderValue("name", "\"value 9\""), 447new NameValueHeaderValue("name", "value1"), 448new NameValueHeaderValue("name", "value2"), 449new NameValueHeaderValue("name", "value3"), 450new NameValueHeaderValue("name", "\"value 4\""), 451new NameValueHeaderValue("name", "\"value会5\""), 452new NameValueHeaderValue("name", "value6"), 453new NameValueHeaderValue("name", "value7"), 454new NameValueHeaderValue("name", "\"value 8\""), 455new NameValueHeaderValue("name", "\"value 9\""), 480new NameValueHeaderValue("name1", "value1"), 482new NameValueHeaderValue("name3", "3"), 484new NameValueHeaderValue("name4", "value4"), 487new NameValueHeaderValue("name7", "\"value会7\""), 488new NameValueHeaderValue("name8", "value8"), 489new NameValueHeaderValue("name9", "value9"), 490new NameValueHeaderValue("name10", "\"value 10\""), 491new NameValueHeaderValue("name11", "\"value 11\""), 534new NameValueHeaderValue("name1", "value1"), 536new NameValueHeaderValue("name3", "3"), 538new NameValueHeaderValue("name4", "value4"), 541new NameValueHeaderValue("name7", "\"value会7\""), 542new NameValueHeaderValue("name8", "value8"), 543new NameValueHeaderValue("name9", "value9"), 544new NameValueHeaderValue("name10", "\"value 10\""), 545new NameValueHeaderValue("name11", "\"value 11\""), 580var header = new NameValueHeaderValue("test", input); 675var nameValue = new NameValueHeaderValue("text", value); 681Assert.Throws<FormatException>(() => new NameValueHeaderValue(name, value));