135 references to StringSegment
Microsoft.AspNetCore.HostFiltering (1)
HostFilteringMiddleware.cs (1)
103if (allowedHosts is not null && HostString.MatchesAny(new StringSegment(host), allowedHosts))
Microsoft.AspNetCore.Http (1)
HeaderDictionary.cs (1)
127HeaderUtilities.TryParseNonNegativeInt64(new StringSegment(rawValue[0]).Trim(), out value))
Microsoft.AspNetCore.Mvc.Abstractions (2)
ModelBinding\ModelStateDictionary.cs (2)
63var emptySegment = new StringSegment(buffer: string.Empty); 926=> GetNode(new StringSegment(propertyName));
Microsoft.AspNetCore.Mvc.Core (16)
Formatters\MediaType.cs (5)
18private static readonly StringSegment QualityParameter = new StringSegment("q"); 194return ReplaceEncoding(new StringSegment(mediaType), encoding); 239return GetEncoding(new StringSegment(mediaType)); 359var asterisk = new StringSegment("*"); 454return HasName(new StringSegment(name));
Formatters\OutputFormatter.cs (2)
115context.ContentType = new StringSegment(SupportedMediaTypes[0]); 146context.ContentType = new StringSegment(SupportedMediaTypes[i]);
Formatters\TextOutputFormatter.cs (2)
113selectedMediaType = new StringSegment(SupportedMediaTypes[0]); 126selectedMediaType = new StringSegment(mediaTypeWithCharset);
Infrastructure\DefaultOutputFormatterSelector.cs (2)
222formatterContext.ContentType = new StringSegment(contentType); 252formatterContext.ContentType = new StringSegment(possibleOutputContentTypes[j]);
Routing\ViewEnginePath.cs (1)
49var pathSegment = new StringSegment(path);
src\Shared\MediaType\ReadOnlyMediaTypeHeaderValue.cs (4)
276return GetParameter(new StringSegment(parameterName)); 333return GetEncoding(new StringSegment(mediaType)); 511var asterisk = new StringSegment("*"); 606return HasName(new StringSegment(name));
Microsoft.AspNetCore.Mvc.Core.Test (75)
Formatters\AcceptHeaderParserTest.cs (11)
17new MediaTypeSegmentWithQuality(new StringSegment("application/json"),1.0) 34new MediaTypeSegmentWithQuality(new StringSegment("application/json"),1.0), 35new MediaTypeSegmentWithQuality(new StringSegment("application/xml;q=0.8"),0.8) 56new MediaTypeSegmentWithQuality(new StringSegment("application/json"),1.0), 57new MediaTypeSegmentWithQuality(new StringSegment("application/xml"),1.0), 95var expectedMediaTypes = expected.Select(e => new MediaTypeSegmentWithQuality(new StringSegment(e), 1.0)).ToList(); 110new MediaTypeSegmentWithQuality(new StringSegment("application/json"), 1.0), 111new MediaTypeSegmentWithQuality(new StringSegment("application/xml;q=0.8"), 0.8) 160new MediaTypeSegmentWithQuality(new StringSegment("*/*Content-Type"), 1.0), 161new MediaTypeSegmentWithQuality(new StringSegment("application/json"), 1.0), 179new MediaTypeSegmentWithQuality(new StringSegment("application/json"), 1.0),
Formatters\FormatFilterTest.cs (4)
34var mediaType = new StringSegment("application/json"); 63var mediaType = new StringSegment("application/json"); 111var mediaType = new StringSegment(contentType); 325var mediaType = new StringSegment("application/foo");
Formatters\JsonOutputFormatterTestBase.cs (5)
46ContentType = new StringSegment(mediaType), 56Assert.Equal(new StringSegment(expectedContentType), outputFormatterContext.ContentType); 97ContentType = new StringSegment(mediaType.ToString()), 129ContentType = new StringSegment(mediaType.ToString()), 190ContentType = new StringSegment(contentType),
Formatters\MediaTypeTest.cs (14)
21Assert.Equal(new StringSegment("application"), result.Type); 22Assert.Equal(new StringSegment("json"), result.SubType); 52Assert.Equal(new StringSegment(expectedSubTypeWithoutSuffix), result.SubTypeWithoutSuffix); 53Assert.Equal(new StringSegment(expectedSubtypeSuffix), result.SubTypeSuffix); 85Assert.Equal(new StringSegment("application"), result.Type); 86Assert.Equal(new StringSegment("json+bson"), result.SubType); 87Assert.Equal(new StringSegment("json"), result.SubTypeWithoutSuffix); 88Assert.Equal(new StringSegment("bson"), result.SubTypeSuffix); 89Assert.Equal(new StringSegment("pretty"), result.GetParameter("format")); 90Assert.Equal(new StringSegment("0.8"), result.GetParameter("q")); 91Assert.Equal(new StringSegment("utf-8"), result.GetParameter("charset")); 101Assert.Equal(new StringSegment("ediaType"), result.Type); 157var expectedParameter = new StringSegment("utf-8"); 186var expectedParameter = new StringSegment("utf-8");
Formatters\NoContentFormatterTests.cs (3)
39var contentType = useNonNullContentType ? new StringSegment("text/plain") : new StringSegment(); 71ContentType = new StringSegment("text/plain"), 99ContentType = new StringSegment("text/plain"),
Formatters\OutputFormatterTests.cs (2)
63ContentType = new StringSegment(formatter.SupportedMediaTypes[0].ToString()), 92ContentType = new StringSegment(requestedContentType),
Formatters\StreamOutputFormatterTest.cs (2)
18var contentTypeHeader = new StringSegment(contentType); 43var contentTypeHeader = contentType == null ? new StringSegment() : new StringSegment(contentType);
Formatters\StringOutputFormatterTests.cs (7)
43var expectedContentType = new StringSegment(contentType); 50context.ContentType = new StringSegment(contentType); 76Assert.Equal(new StringSegment("text/plain"), context.ContentType); 86var expectedContentType = new StringSegment("text/plain"); 96context.ContentType = new StringSegment("text/plain"); 111var expectedContentType = new StringSegment("text/plain"); 118context.ContentType = new StringSegment("text/plain");
Formatters\SystemTextJsonOutputFormatterTest.cs (6)
51ContentType = new StringSegment(mediaType.ToString()), 79ContentType = new StringSegment(mediaType.ToString()), 106ContentType = new StringSegment(mediaType.ToString()), 135ContentType = new StringSegment(mediaType.ToString()), 197ContentType = new StringSegment(mediaType.ToString()), 237ContentType = new StringSegment(mediaType.ToString()),
Formatters\TextOutputFormatterTests.cs (10)
59ContentType = new StringSegment(httpRequest.Headers.Accept), 85ContentType = new StringSegment(contentType), 92Assert.Equal(new StringSegment(expectedContentType), formatterContext.ContentType); 107ContentType = new StringSegment("application/json"), 117formatterContext.ContentType = new StringSegment("application/json"); 138ContentType = new StringSegment("application/json; charset=utf-7"), 148Assert.Equal(new StringSegment("application/json; charset=utf-8"), formatterContext.ContentType); 164ContentType = new StringSegment(contentType), 183var testContentType = new StringSegment("text/json"); 215var testContentType = new StringSegment("text/json");
Infrastructure\DefaultOutputFormatterSelectorTest.cs (7)
43Assert.Equal(new StringSegment("application/json"), context.ContentType); 73Assert.Equal(new StringSegment("application/json"), context.ContentType); 173Assert.Equal(new StringSegment(expectedContentType), context.ContentType); 202Assert.Equal(new StringSegment("application/json"), context.ContentType); 232Assert.Equal(new StringSegment("application/xml"), context.ContentType); 329Assert.Equal(new StringSegment("text/custom2"), context.ContentType); 360Assert.Equal(new StringSegment("text/custom"), context.ContentType);
ProducesAttributeTests.cs (2)
20var mediaType1 = new StringSegment("application/json"); 21var mediaType2 = new StringSegment("text/json;charset=utf-8");
ProducesResponseTypeAttributeTests.cs (2)
15var mediaType1 = new StringSegment("application/json"); 16var mediaType2 = new StringSegment("text/json;charset=utf-8");
Microsoft.AspNetCore.Mvc.Core.TestCommon (4)
MediaTypeAssert.cs (4)
14Equal(new StringSegment(left), new StringSegment(right)); 19Equal(new StringSegment(left), right); 24Equal(left, new StringSegment(right));
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (8)
XmlDataContractSerializerOutputFormatterTest.cs (4)
125context.ContentType = new StringSegment("application/xml"); 384outputFormatterContext.ContentType = new StringSegment("application/xml"); 417outputFormatterContext.ContentType = new StringSegment(mediaType); 426Assert.Equal(new StringSegment(expectedContentType), outputFormatterContext.ContentType);
XmlSerializerOutputFormatterTest.cs (4)
133context.ContentType = new StringSegment("application/xml"); 357outputFormatterContext.ContentType = new StringSegment("application/xml"); 388outputFormatterContext.ContentType = new StringSegment(mediaType); 397Assert.Equal(new StringSegment(expectedContentType), outputFormatterContext.ContentType);
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (8)
NewtonsoftJsonOutputFormatterTest.cs (3)
454ContentType = new StringSegment(mediaType.ToString()), 499ContentType = new StringSegment(mediaType.ToString()), 533ContentType = new StringSegment(mediaType.ToString()),
src\Mvc\Mvc.Core\test\Formatters\JsonOutputFormatterTestBase.cs (5)
46ContentType = new StringSegment(mediaType), 56Assert.Equal(new StringSegment(expectedContentType), outputFormatterContext.ContentType); 97ContentType = new StringSegment(mediaType.ToString()), 129ContentType = new StringSegment(mediaType.ToString()), 190ContentType = new StringSegment(contentType),
Microsoft.AspNetCore.Owin (1)
DictionaryStringValuesWrapper.cs (1)
57HeaderUtilities.TryParseNonNegativeInt64(new StringSegment(rawValue[0]).Trim(), out value))
Microsoft.AspNetCore.Routing (4)
src\Shared\MediaType\ReadOnlyMediaTypeHeaderValue.cs (4)
276return GetParameter(new StringSegment(parameterName)); 333return GetEncoding(new StringSegment(mediaType)); 511var asterisk = new StringSegment("*"); 606return HasName(new StringSegment(name));
Microsoft.AspNetCore.Server.HttpSys (2)
src\Shared\HttpSys\RequestProcessing\HeaderCollection.cs (1)
132HeaderUtilities.TryParseNonNegativeInt64(new StringSegment(rawValue[0]).Trim(), out value))
src\Shared\HttpSys\RequestProcessing\RequestHeaders.cs (1)
188HeaderUtilities.TryParseNonNegativeInt64(new StringSegment(rawValue[0]).Trim(), out value))
Microsoft.AspNetCore.Server.IIS (2)
src\Shared\HttpSys\RequestProcessing\HeaderCollection.cs (1)
132HeaderUtilities.TryParseNonNegativeInt64(new StringSegment(rawValue[0]).Trim(), out value))
src\Shared\HttpSys\RequestProcessing\RequestHeaders.cs (1)
188HeaderUtilities.TryParseNonNegativeInt64(new StringSegment(rawValue[0]).Trim(), out value))
Microsoft.AspNetCore.Shared.Tests (2)
src\Shared\HttpSys\RequestProcessing\HeaderCollection.cs (1)
132HeaderUtilities.TryParseNonNegativeInt64(new StringSegment(rawValue[0]).Trim(), out value))
src\Shared\HttpSys\RequestProcessing\RequestHeaders.cs (1)
188HeaderUtilities.TryParseNonNegativeInt64(new StringSegment(rawValue[0]).Trim(), out value))
Microsoft.AspNetCore.WebUtilities (1)
MultipartReader.cs (1)
58boundary = HeaderUtilities.RemoveQuotes(new StringSegment(boundary)).ToString();
Microsoft.Extensions.Primitives (1)
StringSegment.cs (1)
307public static implicit operator StringSegment(string? value) => new StringSegment(value);
Microsoft.Net.Http.Headers (1)
StringWithQualityHeaderValueComparer.cs (1)
17private static readonly StringSegment Any = new("*");
Microsoft.Net.Http.Headers.Tests (6)
HeaderUtilitiesTest.cs (2)
351var input = new StringSegment(inputString); 403var input = new StringSegment(inputString);
MediaTypeHeaderValueTest.cs (4)
56Assert.Equal(new StringSegment(expectedSubTypeWithoutSuffix), result.SubTypeWithoutSuffix); // TODO consider overloading to have SubTypeWithoutSuffix? 57Assert.Equal(new StringSegment(expectedSubTypeSuffix), result.Suffix); 77Assert.Equal(new StringSegment(expectedSubTypeWithoutSuffix), result.SubTypeWithoutSuffix); // TODO consider overloading to have SubTypeWithoutSuffix? 78Assert.Equal(new StringSegment(expectedSubTypeSuffix), result.Suffix);