Open ghost opened 7 years ago
We could ofcourse extend that list with all possible HTTP status, but these are the only viable ones as a response to a GET request.
If you want an error response, you can just throw an exception and it will generate a 400 error.
Hope that helps you.
I think it's easier to understand if you think of the IGetResponse, IPostResponse, IPutResponse, IDeleteResponse as the response to the intent of the request.
Imo we should expand the error codes slightly for the IPostResponse / IPutResponse (Unauthorized, for example) to represent more clearer error intentions, but for the GetResponse I think we've covered them.
@tomkuijsten as a side note it might be nice to add a BadRequestException that will convert into a 400 error and any other unhandled exceptions can then be converted to 500 (InternalServerError). This might capture what a user might expect better.
Might be a good idea to add something as a ErrorResponse (instead of an exception) which can always be returned with a error code > 400. Let's create an issue for this to design the thing.
(you could also fill out that graph with a whole host of others....
Love the code... So far works really well. I'll let you know if I come upon anything else.