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