Add support for custom endpoint (fixes GH-20)