merge release/2.2 into master

This commit is contained in:
Justin Kotalik 2018-07-30 13:55:15 -07:00
commit 8f10ccff89
3 changed files with 19 additions and 1 deletions

View File

@ -1,2 +1,7 @@
<<<<<<< HEAD
version:3.0.0-alpha1-10015
commithash:3f36e5c2f061712f76f2766c435d2555681d5c55
=======
version:2.2.0-preview1-17102
commithash:e7e2b5a97ca92cfc6acc4def534cb0901a6d1eb9
>>>>>>> merge/release/2.2-to-master

View File

@ -650,6 +650,7 @@ namespace Microsoft.Net.Http.Headers
{
return true;
}
if (set.Suffix.HasValue)
{
if (Suffix.HasValue)
@ -663,7 +664,10 @@ namespace Microsoft.Net.Http.Headers
}
else
{
return set.SubType.Equals(SubType, StringComparison.OrdinalIgnoreCase);
// If this subtype or suffix matches the subtype of the set,
// it is considered a subtype.
// Ex: application/json > application/val+json
return MatchesEitherSubtypeOrSuffix(set);
}
}
@ -673,6 +677,12 @@ namespace Microsoft.Net.Http.Headers
set.SubTypeWithoutSuffix.Equals(SubTypeWithoutSuffix, StringComparison.OrdinalIgnoreCase);
}
private bool MatchesEitherSubtypeOrSuffix(MediaTypeHeaderValue set)
{
return set.SubType.Equals(SubType, StringComparison.OrdinalIgnoreCase) ||
set.SubType.Equals(Suffix, StringComparison.OrdinalIgnoreCase);
}
private bool MatchesParameters(MediaTypeHeaderValue set)
{
if (set._parameters != null && set._parameters.Count != 0)

View File

@ -750,6 +750,8 @@ namespace Microsoft.Net.Http.Headers
[InlineData("application/entity+json", "application/entity+json")]
[InlineData("application/*+json", "application/entity+json")]
[InlineData("application/*+json", "application/*+json")]
[InlineData("application/json", "application/problem+json")]
[InlineData("application/json", "application/vnd.restful+json")]
[InlineData("application/*", "application/*+JSON")]
[InlineData("application/vnd.github+json", "application/vnd.github+json")]
[InlineData("application/*", "application/entity+JSON")]
@ -774,6 +776,7 @@ namespace Microsoft.Net.Http.Headers
[InlineData("application/*+*", "application/json")]
[InlineData("application/entity+*", "application/entity+json")] // We don't allow suffixes to be wildcards
[InlineData("application/*+*", "application/entity+json")] // We don't allow suffixes to be wildcards
[InlineData("application/entity+json", "application/entity")]
public void IsSubSetOfWithSuffixes_NegativeCases(string set, string subset)
{
// Arrange