c# - What HTTP status codes can a WebAPI controller return? -
i know methods can return:
- 200 ok - if goes well;
- 401 unauthorized - if unauthorized;
- 422 unprocessable entity - because explicitly return in of actions;
- 500 internal server error - in case there's unexpected exception thrown somewhere.
i'm wondering, if other status codes possible if don't explicitly return them - i.e. if can happen outside of actions?
edit:
it seems wasn't clear enough. make clearer: know i can return code want. question is, codes can the framework return without direct intention (i.e. if can happen outside of actions return error code different 500). 401 unauthorized - i'm not returning explicitly, 'happens'.
check enum httpstatuscode
also can refer to: https://msdn.microsoft.com/en-us/library/system.net.httpstatuscode(v=vs.110).aspx
Comments
Post a Comment