Remove problem+json Content-Type (#7440)

Addresses #7344
This commit is contained in:
Jass Bagga 2018-03-06 13:46:40 -08:00 committed by GitHub
parent 89c94d0823
commit f3ffdada95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -29,15 +29,15 @@ namespace Microsoft.AspNetCore.Mvc.Internal
IActionResult GetInvalidModelStateResponse(ActionContext context)
{
var errorDetails = _errorDescriptionFactory.CreateErrorDescription(
context.ActionDescriptor,
context.ActionDescriptor,
context.ModelState);
var result = (errorDetails is ModelStateDictionary modelState) ?
new BadRequestObjectResult(modelState) :
new BadRequestObjectResult(errorDetails);
result.ContentTypes.Add("application/problem+json");
result.ContentTypes.Add("application/problem+json");
result.ContentTypes.Add("application/json");
result.ContentTypes.Add("application/xml");
return result;
}

View File

@ -40,7 +40,7 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests
// Assert
Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
Assert.Equal("application/problem+json", response.Content.Headers.ContentType.MediaType);
Assert.Equal("application/json", response.Content.Headers.ContentType.MediaType);
var actual = JsonConvert.DeserializeObject<Dictionary<string, string[]>>(await response.Content.ReadAsStringAsync());
Assert.Collection(
actual.OrderBy(kvp => kvp.Key),