Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

Adding ModelStateError if there is no input formatter selected. #1046

Merged
merged 0 commits into from
Aug 23, 2014

Conversation

harshgMSFT
Copy link
Contributor

No description provided.

@harshgMSFT
Copy link
Contributor Author

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>
Copy link
Member

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.

Copy link
Contributor Author

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?

Copy link
Member

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

Copy link
Contributor Author

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."

@rynowak
Copy link
Member

rynowak commented Aug 20, 2014

@harshgMSFT
Copy link
Contributor Author

Updated.

{
MethodInfo = typeof(TestController).GetTypeInfo()
.DeclaredMethods
.First(m => m.Name.Equals("ActionMethodWithDefaultValues", StringComparison.Ordinal)),
Copy link
Member

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")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

@yishaigalatzer
Copy link
Contributor

:shipit: when @rynowak is happy

@rynowak
Copy link
Member

rynowak commented Aug 22, 2014

:shipit:

@harshgMSFT harshgMSFT merged commit 313a537 into dev Aug 23, 2014
@harshgMSFT harshgMSFT force-pushed the InputFormatterMissing_ModelStateError branch from 17787fd to 313a537 Compare August 23, 2014 00:10
@harshgMSFT harshgMSFT deleted the InputFormatterMissing_ModelStateError branch August 25, 2014 16:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants