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.

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.3.0-preview. Updated on June 13, 2025, 11:37