iotagent-node-lib
iotagent-node-lib copied to clipboard
NGSIv2 subscribe does not support https in cbHost payload
current code is as follows:
if (device.cbHost) {
options.uri = 'http://' + device.cbHost + '/v2/subscriptions';
} else {
options.uri = config.getConfig().contextBroker.url + '/v2/subscriptions';
}
while it should (probably) be:
if (device.cbHost && device.cbHost.indexOf('://') !== -1) {
options.uri = device.cbHost + '/v2/subscriptions';
} else if (device.cbHost && device.cbHost.indexOf('://') === -1) {
options.uri = 'http://' + device.cbHost + '/v2/subscriptions';
} else {
options.uri = config.getConfig().contextBroker.url + '/v2/subscriptions';
}
Is this issue as spinf of for https://github.com/telefonicaid/iotagent-node-lib/issues/593 ?
yep but for ngsiv2, i am fix it and adding tests