-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Adding ModelStateError if there is no input formatter selected. #1046
Conversation
Fixes #458 |
@@ -318,6 +318,9 @@ | |||
<data name="InputFormatterNoEncoding" xml:space="preserve"> | |||
<value>No encoding found for input formatter '{0}'. There must be at least one supported encoding registered in order for the formatter to read content.</value> | |||
</data> | |||
<data name="UnsupportedContentType" xml:space="preserve"> | |||
<value>415: Unsupported content type '{0}'.</value> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thing about model state errors is that they are often echoed back to the client verbatim, so we should think about what goes here.
The 415 doesn't belong here.
I guess we don't really have a way to list supported content types right now, but that would be super useful.
Parameter type and name seem unhelpful/bad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ummm.. okay we can take out the 415 ...
didn't really understand
"Parameter type and name seem unhelpful/bad" where do you see paramtertype?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to think of how I would fix this problem if I encountered it as a client of your API. What... ideally would be in the message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, we can instead add a message like so:
"Unsupported content type '{0}', consider changing the request content type or the list of input formatters."
⌚ |
Updated. |
{ | ||
MethodInfo = typeof(TestController).GetTypeInfo() | ||
.DeclaredMethods | ||
.First(m => m.Name.Equals("ActionMethodWithDefaultValues", StringComparison.Ordinal)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to just do typeof(TestController).GetTypeInfo().GetMethod("ActionMethodWithDefaultValues")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
|
|
17787fd
to
313a537
Compare
No description provided.