iotagent-node-lib icon indicating copy to clipboard operation
iotagent-node-lib copied to clipboard

NGSIv2 subscribe does not support https in cbHost payload

Open chicco785 opened this issue 7 years ago • 2 comments

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';
    }

chicco785 avatar Oct 19 '18 16:10 chicco785

Is this issue as spinf of for https://github.com/telefonicaid/iotagent-node-lib/issues/593 ?

fgalan avatar Oct 23 '18 11:10 fgalan

yep but for ngsiv2, i am fix it and adding tests

chicco785 avatar Oct 23 '18 12:10 chicco785