186 instantiations of NameValueHeaderValue
Microsoft.Net.Http.Headers (10)
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 (4)
89
return new
NameValueHeaderValue
()
107
return new
NameValueHeaderValue
()
364
parsedValue = new
NameValueHeaderValue
();
378
parsedValue = new
NameValueHeaderValue
();
Microsoft.Net.Http.Headers.Tests (176)
CacheControlHeaderValueTest.cs (21)
62
cacheControl.Extensions.Add(new
NameValueHeaderValue
("name", "value"));
64
Assert.Equal(new
NameValueHeaderValue
("name", "value"), cacheControl.Extensions.First());
97
cacheControl.Extensions.Add(new
NameValueHeaderValue
("custom"));
98
cacheControl.Extensions.Add(new
NameValueHeaderValue
("customName", "customValue"));
102
cacheControl.Extensions.Add(new
NameValueHeaderValue
("custom"));
234
cacheControl4.Extensions.Add(new
NameValueHeaderValue
("custom"));
237
cacheControl5.Extensions.Add(new
NameValueHeaderValue
("customN", "customV"));
238
cacheControl5.Extensions.Add(new
NameValueHeaderValue
("custom"));
241
cacheControl4.Extensions.Add(new
NameValueHeaderValue
("customN", "customV"));
364
cacheControl5.Extensions.Add(new
NameValueHeaderValue
("custom"));
367
cacheControl6.Extensions.Add(new
NameValueHeaderValue
("customN", "customV"));
368
cacheControl6.Extensions.Add(new
NameValueHeaderValue
("custom"));
371
cacheControl5.Extensions.Add(new
NameValueHeaderValue
("customN", "customV"));
398
expected.Extensions.Add(new
NameValueHeaderValue
("custom"));
407
expected.Extensions.Add(new
NameValueHeaderValue
("c", "d"));
408
expected.Extensions.Add(new
NameValueHeaderValue
("a", "b"));
418
expected.Extensions.Add(new
NameValueHeaderValue
("custom", ""));
492
expected.Extensions.Add(new
NameValueHeaderValue
("custom"));
496
expected.Extensions.Add(new
NameValueHeaderValue
("custom", ""));
529
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 (23)
156
mediaType0.Parameters.Add(new
NameValueHeaderValue
("name", "value"));
173
mediaType0.Parameters.Add(new
NameValueHeaderValue
("name", "value"));
184
Assert.Throws<NotSupportedException>(() => mediaType1.Parameters.Add(new
NameValueHeaderValue
("name")));
185
Assert.Throws<NotSupportedException>(() => mediaType1.Parameters.Remove(new
NameValueHeaderValue
("name")));
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"));
404
expected.Parameters.Add(new
NameValueHeaderValue
("custom"));
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 (99)
11
Assert.Throws<ArgumentException>(() => new
NameValueHeaderValue
(null));
13
Assert.Throws<ArgumentException>(() => new
NameValueHeaderValue
(string.Empty));
31
var nameValue = new
NameValueHeaderValue
("text", null);
60
var pair0 = new
NameValueHeaderValue
("name");
76
var pair0 = new
NameValueHeaderValue
("name");
95
var pair0 = new
NameValueHeaderValue
("name", "value");
110
var pair0 = new
NameValueHeaderValue
("name", "value");
128
var pair0 = new
NameValueHeaderValue
("name", "value");
145
Assert.Throws<FormatException>(() => { var x = new
NameValueHeaderValue
("name"); x.Value = " x "; });
146
Assert.Throws<FormatException>(() => { var x = new
NameValueHeaderValue
("name"); x.Value = "x y"; });
152
var nameValue = new
NameValueHeaderValue
("text", "token");
168
var nameValue1 = new
NameValueHeaderValue
("text");
169
var nameValue2 = new
NameValueHeaderValue
("text");
207
var nameValue1 = new
NameValueHeaderValue
("text");
208
var nameValue2 = new
NameValueHeaderValue
("TEXT");
215
var nameValue1 = new
NameValueHeaderValue
("text");
216
var nameValue2 = new
NameValueHeaderValue
("text");
260
var nameValue1 = new
NameValueHeaderValue
("text");
261
var nameValue2 = new
NameValueHeaderValue
("TEXT");
268
CheckValidParse(" name = value ", new
NameValueHeaderValue
("name", "value"));
269
CheckValidParse(" name", new
NameValueHeaderValue
("name"));
270
CheckValidParse(" name ", new
NameValueHeaderValue
("name"));
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"));
304
CheckValidTryParse(" name", new
NameValueHeaderValue
("name"));
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"),
481
new
NameValueHeaderValue
("name2"),
482
new
NameValueHeaderValue
("name3", "3"),
483
new
NameValueHeaderValue
("a"),
484
new
NameValueHeaderValue
("name4", "value4"),
485
new
NameValueHeaderValue
("b"),
486
new
NameValueHeaderValue
("6"),
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"),
535
new
NameValueHeaderValue
("name2"),
536
new
NameValueHeaderValue
("name3", "3"),
537
new
NameValueHeaderValue
("a"),
538
new
NameValueHeaderValue
("name4", "value4"),
539
new
NameValueHeaderValue
("b"),
540
new
NameValueHeaderValue
("6"),
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);
600
var header = new
NameValueHeaderValue
("test");
614
var header = new
NameValueHeaderValue
("test");
624
var header = new
NameValueHeaderValue
("test");
639
var header = new
NameValueHeaderValue
("test");
675
var nameValue = new
NameValueHeaderValue
("text", value);
681
Assert.Throws<FormatException>(() => new
NameValueHeaderValue
(name, value));
156 references to NameValueHeaderValue
Microsoft.Net.Http.Headers (92)
CacheControlHeaderValue.cs (13)
102
private IList<
NameValueHeaderValue
>? _extensions;
316
public IList<
NameValueHeaderValue
> Extensions
322
_extensions = new ObjectCollection<
NameValueHeaderValue
>();
393
NameValueHeaderValue
.ToString(_extensions, ',', false, sb);
474
foreach (
var
extension in _extensions)
532
var nameValueList = new List<
NameValueHeaderValue
>();
535
if (!
NameValueHeaderValue
.MultipleValueParser.TryParseValue(input, ref current, out
var
nameValue))
566
List<
NameValueHeaderValue
> nameValueList)
570
var
nameValue = nameValueList[i];
698
private static bool TrySetTokenOnlyValue(
NameValueHeaderValue
nameValue, ref bool boolField)
710
NameValueHeaderValue
nameValue,
771
private static bool TrySetTimeSpan(
NameValueHeaderValue
nameValue, ref TimeSpan? timeSpan)
ContentDispositionHeaderValue.cs (18)
47
private ObjectCollection<
NameValueHeaderValue
>? _parameters;
81
public IList<
NameValueHeaderValue
> Parameters
87
_parameters = new ObjectCollection<
NameValueHeaderValue
>();
158
var
sizeParameter =
NameValueHeaderValue
.Find(_parameters, SizeString);
171
var
sizeParameter =
NameValueHeaderValue
.Find(_parameters, SizeString);
227
return _dispositionType +
NameValueHeaderValue
.ToString(_parameters, ';', true);
248
return StringSegmentComparer.OrdinalIgnoreCase.GetHashCode(_dispositionType) ^
NameValueHeaderValue
.GetHashCode(_parameters);
302
int parameterLength =
NameValueHeaderValue
.GetNameValueListLength(input, current, ';',
354
var
dateParameter =
NameValueHeaderValue
.Find(_parameters, parameter);
375
var
dateParameter =
NameValueHeaderValue
.Find(_parameters, parameter);
403
var
nameParameter =
NameValueHeaderValue
.Find(_parameters, parameter);
432
var
nameParameter =
NameValueHeaderValue
.Find(_parameters, parameter);
HeaderUtilities.cs (7)
21
internal static void SetQuality(IList<
NameValueHeaderValue
> parameters, double? value)
23
var
qualityParameter =
NameValueHeaderValue
.Find(parameters, QualityName);
56
internal static double? GetQuality(IList<
NameValueHeaderValue
>? parameters)
58
var
qualityParameter =
NameValueHeaderValue
.Find(parameters, QualityName);
193
current +=
NameValueHeaderValue
.GetValueLength(headerValue, current);
MediaTypeHeaderValue.cs (18)
36
private ObjectCollection<
NameValueHeaderValue
>? _parameters;
76
return
NameValueHeaderValue
.Find(_parameters, CharsetString)?.Value ?? default;
83
var
charsetParameter =
NameValueHeaderValue
.Find(_parameters, CharsetString);
152
return
NameValueHeaderValue
.Find(_parameters, BoundaryString)?.Value ?? default(StringSegment);
157
var
boundaryParameter =
NameValueHeaderValue
.Find(_parameters, BoundaryString);
184
public IList<
NameValueHeaderValue
> Parameters
192
_parameters = ObjectCollection<
NameValueHeaderValue
>.EmptyReadOnlyCollection;
196
_parameters = new ObjectCollection<
NameValueHeaderValue
>();
410
other._parameters = new ObjectCollection<
NameValueHeaderValue
>(
432
other._parameters = new ObjectCollection<
NameValueHeaderValue
>(
469
NameValueHeaderValue
.ToString(_parameters, separator: ';', leadingSeparator: true, destination: builder);
491
return StringSegmentComparer.OrdinalIgnoreCase.GetHashCode(_mediaType) ^
NameValueHeaderValue
.GetHashCode(_parameters);
590
var parameterLength =
NameValueHeaderValue
.GetNameValueListLength(input, current, ';',
789
foreach (
var
parameter in set._parameters)
805
var
localParameter =
NameValueHeaderValue
.Find(_parameters, parameter.Name);
NameValueHeaderValue.cs (36)
20
private static readonly HttpHeaderParser<
NameValueHeaderValue
> SingleValueParser
21
= new GenericHeaderParser<
NameValueHeaderValue
>(false, GetNameValueLength);
22
internal static readonly HttpHeaderParser<
NameValueHeaderValue
> MultipleValueParser
23
= new GenericHeaderParser<
NameValueHeaderValue
>(true, GetNameValueLength);
35
/// Initializes a new instance of <see cref="
NameValueHeaderValue
"/>.
44
/// Initializes a new instance of <see cref="
NameValueHeaderValue
"/>.
87
public
NameValueHeaderValue
Copy()
99
/// <returns>The readonly <see cref="
NameValueHeaderValue
"/>.</returns>
100
public
NameValueHeaderValue
CopyAsReadOnly()
140
var
other = obj as
NameValueHeaderValue
;
204
/// Parses <paramref name="input"/> as a <see cref="
NameValueHeaderValue
"/> value.
208
public static
NameValueHeaderValue
Parse(StringSegment input)
215
/// Attempts to parse the specified <paramref name="input"/> as a <see cref="
NameValueHeaderValue
"/>.
219
/// <returns><see langword="true"/> if input is a valid <see cref="
NameValueHeaderValue
"/>, otherwise <see langword="false"/>.</returns>
220
public static bool TryParse(StringSegment input, [NotNullWhen(true)] out
NameValueHeaderValue
? parsedValue)
227
/// Parses a sequence of inputs as a sequence of <see cref="
NameValueHeaderValue
"/> values.
231
public static IList<
NameValueHeaderValue
> ParseList(IList<string>? input)
237
/// Parses a sequence of inputs as a sequence of <see cref="
NameValueHeaderValue
"/> values using string parsing rules.
241
public static IList<
NameValueHeaderValue
> ParseStrictList(IList<string>? input)
247
/// Attempts to parse the sequence of values as a sequence of <see cref="
NameValueHeaderValue
"/>.
251
/// <returns><see langword="true"/> if all inputs are valid <see cref="
NameValueHeaderValue
"/>, otherwise <see langword="false"/>.</returns>
252
public static bool TryParseList(IList<string>? input, [NotNullWhen(true)] out IList<
NameValueHeaderValue
>? parsedValues)
258
/// Attempts to parse the sequence of values as a sequence of <see cref="
NameValueHeaderValue
"/> using string parsing rules.
263
public static bool TryParseStrictList(IList<string>? input, [NotNullWhen(true)] out IList<
NameValueHeaderValue
>? parsedValues)
279
IList<
NameValueHeaderValue
>? values,
307
internal static string? ToString(IList<
NameValueHeaderValue
>? values, char separator, bool leadingSeparator)
321
internal static int GetHashCode(IList<
NameValueHeaderValue
>? values)
336
private static int GetNameValueLength(StringSegment input, int startIndex, out
NameValueHeaderValue
? parsedValue)
392
IList<
NameValueHeaderValue
> nameValueCollection)
404
var nameValueLength = GetNameValueLength(input, current, out
var
parameter);
429
/// Finds a <see cref="
NameValueHeaderValue
"/> with the specified <paramref name="name"/>.
433
/// <returns>The <see cref="
NameValueHeaderValue
" /> if found, otherwise <see langword="null" />.</returns>
434
public static
NameValueHeaderValue
? Find(IList<
NameValueHeaderValue
>? values, StringSegment name)
445
var
value = values[i];
Microsoft.Net.Http.Headers.Tests (64)
ContentDispositionHeaderValueTest.cs (9)
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");
MediaTypeHeaderValueTest.cs (9)
162
var
pair0 = mediaType0.Parameters.First();
163
var
pair1 = mediaType1.Parameters.First();
188
var
pair0 = mediaType0.Parameters.First();
189
var
pair1 = mediaType1.Parameters.First();
211
var
pair2 = mediaType2.Parameters.First();
212
var
pair1 = mediaType1.Parameters.First();
251
var
charset = new NameValueHeaderValue("CHARSET", "old_charset");
286
var
quality = new NameValueHeaderValue("q", "0.132");
306
var
quality = new NameValueHeaderValue("Q", "0.132");
NameValueHeaderValueTest.cs (46)
31
var
nameValue = new NameValueHeaderValue("text", null);
60
var
pair0 = new NameValueHeaderValue("name");
61
var
pair1 = pair0.Copy();
76
var
pair0 = new NameValueHeaderValue("name");
77
var
pair1 = pair0.CopyAsReadOnly();
95
var
pair0 = new NameValueHeaderValue("name", "value");
96
var
pair1 = pair0.Copy();
110
var
pair0 = new NameValueHeaderValue("name", "value");
111
var
pair1 = pair0.CopyAsReadOnly();
128
var
pair0 = new NameValueHeaderValue("name", "value");
129
var
pair1 = pair0.CopyAsReadOnly();
130
var
pair2 = pair1.Copy();
145
Assert.Throws<FormatException>(() => {
var
x = new NameValueHeaderValue("name"); x.Value = " x "; });
146
Assert.Throws<FormatException>(() => {
var
x = new NameValueHeaderValue("name"); x.Value = "x y"; });
152
var
nameValue = new NameValueHeaderValue("text", "token");
168
var
nameValue1 = new NameValueHeaderValue("text");
169
var
nameValue2 = new NameValueHeaderValue("text");
207
var
nameValue1 = new NameValueHeaderValue("text");
208
var
nameValue2 = new NameValueHeaderValue("TEXT");
215
var
nameValue1 = new NameValueHeaderValue("text");
216
var
nameValue2 = new NameValueHeaderValue("text");
260
var
nameValue1 = new NameValueHeaderValue("text");
261
var
nameValue2 = new NameValueHeaderValue("TEXT");
344
var results =
NameValueHeaderValue
.ParseList(inputs);
377
var results =
NameValueHeaderValue
.ParseStrictList(inputs);
410
Assert.True(
NameValueHeaderValue
.TryParseList(inputs, out var results));
443
Assert.True(
NameValueHeaderValue
.TryParseStrictList(inputs, out var results));
476
var results =
NameValueHeaderValue
.ParseList(inputs);
512
Assert.Throws<FormatException>(() =>
NameValueHeaderValue
.ParseStrictList(inputs));
530
Assert.True(
NameValueHeaderValue
.TryParseList(inputs, out var results));
566
Assert.False(
NameValueHeaderValue
.TryParseStrictList(inputs, out var results));
580
var
header = new NameValueHeaderValue("test", input);
600
var
header = new NameValueHeaderValue("test");
614
var
header = new NameValueHeaderValue("test");
624
var
header = new NameValueHeaderValue("test");
639
var
header = new NameValueHeaderValue("test");
650
private void CheckValidParse(string? input,
NameValueHeaderValue
expectedResult)
652
var
result =
NameValueHeaderValue
.Parse(input);
658
Assert.Throws<FormatException>(() =>
NameValueHeaderValue
.Parse(input));
661
private void CheckValidTryParse(string? input,
NameValueHeaderValue
expectedResult)
663
Assert.True(
NameValueHeaderValue
.TryParse(input, out
var
result));
669
Assert.False(
NameValueHeaderValue
.TryParse(input, out
var
result));
675
var
nameValue = new NameValueHeaderValue("text", value);