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).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

klausi’s picture

Status: Needs review » Fixed

Committed with a newline fix at the end, thanks!

  • Commit cf03122 on 7.x-2.x authored by mr.baileys, committed by klausi:
    Issue #2284355 by mr.baileys: DRY: refactor request termination code...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.