You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A new struct Microsoft.Framework.Primitives.StringValues has been introduced to streamline handling of values that may be empty, single strings, or multiple strings. The value is implicitly convertable to and from string and string[], and also provides helpers like Concat and IsNullOrEmpty.
The type is now used in request and response headers, query values, and form values. As such there have been some API changes in IHeaderDictionary and IReadableStringCollection (used in Form and Query). The indexer is now the primary API for these collections since the presence and plurality are taken care of by StringValues.
Examples:
string combineValue = httpContext.Request.Headers["header1];
if (string.IsNullOrEmpty(combineValue)) // ...
var values = httpContext.Request.Headers["header1"];
if (StringValues.IsNullOrEmpty(values)) // ...
httpContext.Response.Headers["CustomHeader1"] = "singleValue";
httpContext.Response.Headers["CustomHeader2"] = new[] { "firstValue", "secondValue" };
A new struct Microsoft.Framework.Primitives.StringValues has been introduced to streamline handling of values that may be empty, single strings, or multiple strings. The value is implicitly convertable to and from string and string[], and also provides helpers like Concat and IsNullOrEmpty.
https://github.com/aspnet/HttpAbstractions/blob/dev/src/Microsoft.Framework.Primitives/StringValues.cs
The type is now used in request and response headers, query values, and form values. As such there have been some API changes in IHeaderDictionary and IReadableStringCollection (used in Form and Query). The indexer is now the primary API for these collections since the presence and plurality are taken care of by StringValues.
Examples:
Also note that some APIs from IHeaderDictionary have been moved to extension methods in the Microsoft.AspNet.Http.Extensions package. See https://github.com/aspnet/HttpAbstractions/blob/dev/src/Microsoft.AspNet.Http.Extensions/HeaderDictionaryExtensions.cs
See aspnet/HttpAbstractions#382 for discussion.
The text was updated successfully, but these errors were encountered: