[wp-trac] [WordPress Trac] #42240: Improve returned status codes for admin-ajax.php

WordPress Trac noreply at wordpress.org
Mon Oct 16 17:29:49 UTC 2017


#42240: Improve returned status codes for admin-ajax.php
--------------------------+-------------------
 Reporter:  Clorith       |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  4.9
Component:  General       |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-------------------
 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.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42240>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list