Open Closed

Different HTTP status code from application layer #5686


User avatar
0
sukhdeep.dhillon created
  • ABP Framework version: v6.0.2
  • UI Type: MVC
  • Database System: EF Core (SQL Server)

Hi, how can I return different http status code from application layer methods.

for example, for post request, ABP by default returns 200 but I want to return 201.

how can I do that in application layer without going thru controllers.


1 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Unfortunately, you can't do this, because the application layer can't access httpcontext.

    You can write a middleware to modify the http status code.

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11