Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The code to terminate a request (echo a message, add a status code header, call drupal_page_footer() and exit) is repeated numerous times throughout restws.module. Attached is a patch that aims to get rid of the duplicated code and improve legibility by refactoring it into a restws_terminate_request() function (I would have preferred to name it restws_exit(), analogous with drupal_exit(), but this makes Drupal think it is an hook_exit implementation).
Comment | File | Size | Author |
---|---|---|---|
restws_request_termination_dry.patch | 3.8 KB | mr.baileys |
Comments
Comment #1
klausiCommitted with a newline fix at the end, thanks!