You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.
Having no media types in the list after the formatter has been configured during startup is most likely a configuration error. This can happen in two scenarios:
A user is configuring an existing formatter and somehow clears the supported media types list and forgets to add at least a media type.
A user is implementing it's own formatter by extending one of our base classes and forgets do add media types to the list of supported media types inside the constructor or during the initialization of their app.
Should we just do this check in the places where we use it and throw an exception in that situation? The benefit is that the user gets an early error instead of a behavior that depends on the configuration of other pieces of the system. (Maybe the next formatter writes/reads the request/response) or we return something else like 406 or 415.
It also simplifies our implementations as we don't need to be checking if there is one element in the list of supported media types through the code
The text was updated successfully, but these errors were encountered:
I'm a little concerned about the case where someone uses the base class, but overrides CanWrite to do custom logic that doesn't rely on SupportedMediaTypes. As long as we do this in our CanWrite implementation there's no regression for this case.
In our input and output formatters we have a few pieces of code like
Having no media types in the list after the formatter has been configured during startup is most likely a configuration error. This can happen in two scenarios:
Should we just do this check in the places where we use it and throw an exception in that situation? The benefit is that the user gets an early error instead of a behavior that depends on the configuration of other pieces of the system. (Maybe the next formatter writes/reads the request/response) or we return something else like 406 or 415.
It also simplifies our implementations as we don't need to be checking if there is one element in the list of supported media types through the code
The text was updated successfully, but these errors were encountered: