Advertisement
Guest User

Untitled

a guest
Aug 7th, 2016
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import Promise from 'bluebird';
  2. const ntlm = Promise.promisifyAll(require('request-ntlm-continued'));
  3.  
  4. class httpNtlm {
  5.   constructor() {
  6.     this.ntlm = ntlm;
  7.     this.username = config.username;
  8.     this.password = config.password;
  9.   }
  10.  
  11.   get(url, callback) {
  12.     this.ntlm.get({url: url, username: this.username, password: this.password}, undefined)
  13.       .then(body => {
  14.         callback(JSON.parse(body));
  15.       })
  16.       .catch(err => {
  17.         callback(JSON.parse(err));
  18.       });
  19.   }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement