Answer the question
In order to leave comments, you need to log in
Authorization when using the "request" module in Node.js
There is a local TeamCity server.
It is required to get information from the internal page of the server.
To get information, use the request module for Node.js :
var fs = require('fs')
var request = require('request');
request.get('адрес сервера>/login.html').auth('<корректный логин>', '<корректный пароль>', false);
request('<адрес интересующей страницы>').pipe(
fs.createWriteStream('<txt-файл, в который записывается текст с рассматриваемой страницы>')
)
Answer the question
In order to leave comments, you need to log in
See how authorization is done here:
github.com/gogobot/teamcity-radiator/blob/master/t...
var auth = 'Basic ' + new Buffer(username + ':' + password).toString('base64');
var request = client.request('GET', "/httpAuth/app/rest" + path, {'host': base_url, 'Authorization': auth});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question