eris
eris copied to clipboard
Allow configuring RequestHandler to use HTTP instead of HTTPS
My use case was to tunnel all Eris traffic through a central rate limiter (Twilight's http-proxy), which uses HTTP instead of HTTPS. Given that we can already configure the domain and base URL, being able to configure whether to use HTTPS or HTTP seemed logical.
I've named it https
and enabled it by default, to ensure concious opt-out by doing https: false
. A name like useHttps
might be more appropriate.
Could also consider storing the request method (https
or http
module) as an instance variable on RequestHandler instead of doing the ternary on each request, but I figured this'd be fine.
JSDoc and TypeScript typings should be good.
Should we not just take the protocol from the rest URL provided?
The domain doesn't have a protocol prefixed. Using it would probably be neater, but it would break backwards compat.