is it possible to return different status codes like:
400 - Bad Request 401 - Unauthorized 402 - Payment Required 403 - Forbidden 404 - Not Found
using the dynamic api implementation when raising and returning an exception?
ps - awesome product!
1 Answer(s)
-
0
Hi,
Dynamic API layer is designed for who just want to use application service methods easily from javascript side. As I understand, you want to expose services as API to 3rd party companies. You can direcly create regular Web API controllers in this case.
More info: ABP does it in single place: AbpExceptionFilterAttribute class (exactly here: <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/src/Abp.Web.Api/WebApi/Controllers/Filters/AbpExceptionFilterAttribute.cs#L67">https://github.com/aspnetboilerplate/as ... ute.cs#L67</a>). And registers it here: <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/blob/master/src/Abp.Web.Api/WebApi/AbpWebApiModule.cs#L84">https://github.com/aspnetboilerplate/as ... ule.cs#L84</a> So, theorically, you may create your own exception handler (by copying it and change), remove AbpExceptionFilterAttribute from Filters and add your own. Then you can check exception type and return appropriate code.
As alternative, you can create an issue on Github. We can consider it to include in next versions.
Have a nice day.