If apihost already is fully qualified with a protocol, use it as is else assume https.
diff --git a/lib/base_operation.js b/lib/base_operation.js
index 23c5972..603f3b4 100644
--- a/lib/base_operation.js
+++ b/lib/base_operation.js
@@ -29,10 +29,15 @@
url_from_apihost (apihost) {
if (!apihost) return apihost
+ const apipath = '/api/v1/'
+ var protocol = ''
- const is_http = apihost.includes(':') && !apihost.includes(':443')
- const protocol = is_http ? 'http' : 'https'
- return `${protocol}://${apihost}/api/v1/`
+ // if apihost already is fully qualified with a protocol, use it as is
+ // else assume https
+ if (!apihost.startsWith('https://') && !apihost.startsWith('http://')) {
+ protocol = 'https://'
+ }
+ return `${protocol}${apihost}${apipath}`
}
request (options) {