@binoalien/node-digest-auth-client

1.0.7 • Public • Published

node-digest-auth-client

A client request for HTTP digest authentication

Build Status

install

npm install node-digest-auth-client

digestRequest parameter

digestRequest(options, data, user, password, callback);

option (please refer to node.js document)

https://nodejs.org/api/http.html#http_http_request_options_callback

data : body data

user : user name

password : password

callback : callback function (err code, response data)

POST method

let digest = require('node-digest-auth-client');
const postData = "CurrentUTCDateTime=2019-09-04T00:54:50.565Z\r\n";
const options = {
	hostname: '127.0.0.1',
	port: 80,
	path: '/api/test.cgi',
	method: 'POST',
	headers: {
		'Connection': 'Keep-Alive',
		'Content-Type': 'text/plain',
		'Content-Length': postData.length,
		'Host': '127.0.0.1'
	}
};

let GetData = (err, data) => {
	if (err) {
		console.error(err);
	} else {
		console.log(data);
	}
}

digest.digestRequest(options, postData, "test", "test", GetData);

GET method

let digest = require('node-digest-auth-client');

const options = {
	hostname: '127.0.0.1',
	port: 80,
	path: '/api/test.cgi',
	method: 'GET',
	headers: {
		'Connection': 'Keep-Alive',
		'Content-Type': 'text/plain',
		'Host': '127.0.0.1'
	}
};

let GetData = (err, data) => {
	if (err) {
		console.error(err);
	} else {
		console.log(data);
	}
}

digest.digestRequest(options, null, "test", "test", GetData);

Readme

Keywords

Package Sidebar

Install

npm i @binoalien/node-digest-auth-client

Weekly Downloads

0

Version

1.0.7

License

MIT

Unpacked Size

9.45 kB

Total Files

11

Last publish

Collaborators

  • binoalien