digest-auth.js 325 B

12345678910111213141516
  1. var needle = require('./..');
  2. var opts = {
  3. username: 'user3',
  4. password: 'user3',
  5. auth: 'digest'
  6. }
  7. needle.get('http://test.webdav.org/auth-digest/', opts, function(err, resp, body) {
  8. console.log(resp.headers);
  9. if (resp.statusCode == 401)
  10. console.log('\nIt failed.')
  11. else
  12. console.log('\nIt worked!')
  13. });