Re-implement POST handler to support 204 no content responses

This re-writes the POST handler implementation to make it cleaner and handle POSTs with no data by properly responding with a 204 status.