Skip to content
Browse files

Remove some dead code (ResponseFormatterSelectionResult.MatchOnRespon…

…seContentType) left over from content negotiation changes.
  • Loading branch information...
1 parent 87e88d0 commit fba4bb792834d2b42e72873a7b0d7f4eccd31d3d @marcind marcind committed Apr 18, 2012
View
6 src/System.Net.Http.Formatting/Formatting/DefaultContentNegotiator.cs
@@ -86,12 +86,6 @@ private static MediaTypeFormatter RunNegotiation(Type type, HttpRequestMessage r
break;
- case ResponseFormatterSelectionResult.MatchOnResponseContentType:
-
- // Match on response content trumps all other choices
- mediaType = match.MediaTypeMatch.MediaType;
- return formatter;
-
case ResponseFormatterSelectionResult.MatchOnRequestAcceptHeader:
// Matches on accept headers must choose the highest quality match
View
5 src/System.Net.Http.Formatting/Formatting/ResponseFormatterSelectionResult.cs
@@ -19,11 +19,6 @@ internal enum ResponseFormatterSelectionResult
MatchOnCanWriteType,
/// <summary>
- /// Matched on explicit content-type set on the <see cref="HttpResponseMessage"/>.
- /// </summary>
- MatchOnResponseContentType,
-
- /// <summary>
/// Matched on explicit accept header set in <see cref="HttpRequestMessage"/>.
/// </summary>
MatchOnRequestAcceptHeader,
View
17 test/System.Net.Http.Formatting.Test.Unit/Formatting/MediaTypeFormatterTests.cs
@@ -265,23 +265,6 @@ public void SelectResponseMediaTypeMatchesRequestContentType(MediaTypeHeaderValu
Assert.Equal(mediaType.MediaType, match.MediaTypeMatch.MediaType.MediaType);
}
- [TestDataSet(typeof(HttpUnitTestDataSets), "LegalMediaTypeHeaderValues")]
- [Trait("Description", "SelectResponseMediaType(Type, HttpRequestMessage) matches media type from response content type.")]
- public void SelectResponseMediaTypeMatchesResponseContentType(MediaTypeHeaderValue mediaType)
- {
- MockMediaTypeFormatter formatter = new MockMediaTypeFormatter() { CallBase = true };
- formatter.SupportedMediaTypes.Add(mediaType);
- HttpRequestMessage request = new HttpRequestMessage();
- HttpResponseMessage response = new HttpResponseMessage() { RequestMessage = request, Content = new StringContent("fred") };
- response.Content.Headers.ContentType = mediaType;
- ResponseMediaTypeMatch match = formatter.SelectResponseMediaType(typeof(string), request);
-
- Assert.NotNull(match);
- Assert.Equal(ResponseFormatterSelectionResult.MatchOnResponseContentType, match.ResponseFormatterSelectionResult);
- Assert.NotNull(match.MediaTypeMatch.MediaType);
- Assert.Equal(mediaType.MediaType, match.MediaTypeMatch.MediaType.MediaType);
- }
-
[Theory]
[TestDataSet(typeof(HttpUnitTestDataSets), "StandardMediaTypesWithQuality")]
[Trait("Description", "SelectResponseMediaType(Type, HttpRequestMessage) matches supported media type from accept headers.")]

0 comments on commit fba4bb7

Please sign in to comment.
Something went wrong with that request. Please try again.