Opened 7 years ago
Closed 7 years ago
#42240 closed defect (bug) (fixed)
Improve returned status codes for admin-ajax.php
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.9 | Priority: | normal |
Severity: | normal | Version: | 4.9 |
Component: | Administration | Keywords: | has-patch |
Focuses: | Cc: |
Description
in r41120 a status code of 400, Bad Request, was introduced if no request data was provided, but it also makes 400 the default code if the file is left to run till the end.
Anything using admin-ajax.php
would normally end execution once it's done, for better performance, but in some cases it may be desirable to execute multiple actions based on an ajax call.
@westonruter mentioned we could do an has_action()
check and still send a 400 code if there's no registered action for the request, and use 200 as the status if an action exists but it just didn't end execution.
Attachments (1)
Change History (4)
Note: See
TracTickets for help on using
tickets.
42240.patch reverts the default response to not declare a specific response code (as it was previously), but also introduces checks for
has_action()
and returns a bad request if no action has been registered.