Skip to content

Commit

Permalink
Update to use request shim.
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-fox committed Oct 20, 2021
1 parent b9f9c6a commit 6419839
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions bin/sigfox-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/* eslint-disable no-console */

const clUtils = require('command-node');
const request = require('request');
const request = require('iotagent-node-lib').request;
const config = require('../config');
const parameters = {
id: '8405',
Expand Down Expand Up @@ -60,7 +60,7 @@ function sendMeasure(commands) {
console.log('\nData successfully sent');

// Now, we analyse the response obtained in the call
console.log('Response Code [%d]: [%s]', response.statusCode, JSON.parse(body).message);
console.log('Response Code [%d]: [%s]', response.statusCode, body.message);
}

clUtils.prompt();
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@
"dependencies": {
"underscore": "1.12.1",
"command-node": "0.1.1",
"request": "2.88.0",
"async": "1.5.2",
"iotagent-node-lib": "git://github.com/telefonicaid/iotagent-node-lib.git#master",
"iotagent-node-lib": "git://github.com/jason-fox/iotagent-node-lib.git#feature/request-shim",
"express": "4.16.4",
"body-parser": "1.18.3",
"logops": "2.1.0"
Expand Down
2 changes: 2 additions & 0 deletions test/tools/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
*/

const fs = require('fs');
const request = require('iotagent-node-lib').request;

function readExampleFile(name, raw) {
let text = null;
Expand All @@ -35,3 +36,4 @@ function readExampleFile(name, raw) {
}

exports.readExampleFile = readExampleFile;
exports.request = request;
4 changes: 2 additions & 2 deletions test/unit/deviceProvisioning-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
const iotAgent = require('../../lib/iotagentCore');
const _ = require('underscore');
const mappings = require('../../lib/mappings');
const request = require('request');
const mongoUtils = require('../tools/mongoDBUtils');
const utils = require('../tools/utils');
const request = utils.request;
const mongoUtils = require('../tools/mongoDBUtils');
const async = require('async');
const apply = async.apply;
const config = require('../testConfig');
Expand Down
4 changes: 2 additions & 2 deletions test/unit/ngsi-communication-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@

const iotAgent = require('../../lib/iotagentCore');
const mappings = require('../../lib/mappings');
const request = require('request');
const utils = require('../tools/utils');
const request = utils.request;
const iotAgentLib = require('iotagent-node-lib');
const mongoUtils = require('../tools/mongoDBUtils');
const async = require('async');
const apply = async.apply;
const config = require('../testConfig');
const should = require('should');
const nock = require('nock');
const utils = require('../tools/utils');
const sigfoxDevice = {
id: 'sigApp1',
type: 'SIGFOX',
Expand Down
2 changes: 1 addition & 1 deletion test/unit/plugin-config-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
const iotAgent = require('../../lib/iotagentCore');
const _ = require('underscore');
const mappings = require('../../lib/mappings');
const request = require('request');
const utils = require('../tools/utils');
const request = utils.request;
const mongoUtils = require('../tools/mongoDBUtils');
const async = require('async');
const apply = async.apply;
Expand Down

0 comments on commit 6419839

Please sign in to comment.