parent
89c94d0823
commit
f3ffdada95
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
Loading…
Reference in New Issue