Fixes #23 use endAction to wait for the end of request