Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Frigyes Bartha committed Jun 30, 2020
1 parent cff21b2 commit fea03d8
Showing 1 changed file with 8 additions and 40 deletions.
48 changes: 8 additions & 40 deletions carelink.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ var _ = require('lodash'),

var logger = require('./logger');

process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;

var CARELINK_EU = process.env['MMCONNECT_SERVER'] === 'EU';

var DEFAULT_MAX_RETRY_DURATION = module.exports.defaultMaxRetryDuration = 512;
Expand All @@ -34,8 +32,8 @@ function reqOptions(extra) {
var defaults = {
jar: true,
followRedirect: false,
rejectUnauthorized: false,
changeOrigin: true,
//rejectUnauthorized: false,
//changeOrigin: true,
headers: {
//Host: carelinkServerAddress,
Connection: 'keep-alive',
Expand Down Expand Up @@ -69,6 +67,11 @@ function responseAsError(response) {
function checkResponseThen(fn) {
return function (err, response) {
err = err || responseAsError(response);

if (err) {
let x = 1;
}

fn.apply(this, [err].concat(Array.prototype.slice.call(arguments, 1)));
};
}
Expand Down Expand Up @@ -125,10 +128,6 @@ var Client = exports.Client = function (options) {
url,
reqOptions({
jar: jar,
uri: url,
host: getHost(url),
path: getPath(url),
port: 443,
form: {
j_username: options.username,
j_password: options.password,
Expand All @@ -146,10 +145,6 @@ var Client = exports.Client = function (options) {
url,
reqOptions({
jar: jar,
uri: url,
host: getHost(url),
path: getPath(url),
port: 443,
}),
checkResponseThen(next)
);
Expand All @@ -174,12 +169,9 @@ var Client = exports.Client = function (options) {
logger.log('GET ' + url);

request.get(
url,
reqOptions({
jar: jar,
uri: url,
host: getHost(url),
path: getPath(url),
port: 443,
}),
checkResponseThen(next)
);
Expand All @@ -194,10 +186,6 @@ var Client = exports.Client = function (options) {
url,
reqOptions({
jar: jar,
uri: url,
host: getHost(url),
path: getPath(url),
port: 443,
}),
checkResponseThen(next)
);
Expand All @@ -215,10 +203,6 @@ var Client = exports.Client = function (options) {
reqOptions({
jar: jar,
gzip: true,
uri: url,
host: getHost(url),
path: getPath(url),
port: 443,
form: {
sessionID: uriParam.get('sessionID'),
sessionData: uriParam.get('sessionData'),
Expand Down Expand Up @@ -248,10 +232,6 @@ var Client = exports.Client = function (options) {
url,
reqOptions({
jar: jar,
uri: url,
host: getHost(url),
path: getPath(url),
port: 443,
form: {
action: "consent",
sessionID: ps.sessionID,
Expand All @@ -273,10 +253,6 @@ var Client = exports.Client = function (options) {
url,
reqOptions({
jar: jar,
uri: url,
host: getHost(url),
path: getPath(url),
port: 443,
}),
checkResponseThen(next)
);
Expand All @@ -292,10 +268,6 @@ var Client = exports.Client = function (options) {
jar: jar,
gzip: true,
json: true,
uri: url,
host: getHost(url),
path: getPath(url),
port: 443,
headers: {
Authorization: "Bearer " + _.get(getCookie(CARELINKEU_TOKEN_COOKIE), 'value', ''),
},
Expand All @@ -321,10 +293,6 @@ var Client = exports.Client = function (options) {
var reqO = {
jar: jar,
gzip: true,
uri: url,
host: getHost(url),
path: getPath(url),
port: 443,
headers: {
},
};
Expand Down

0 comments on commit fea03d8

Please sign in to comment.