it('never appends the searchDomain to fqdns in uri', function() {
   var options = { searchDomain: 'bar123' };
   return assert
     .rejects(fetch('http://some.invalid.thing./a/path', options))
     .then(function(error) {
       assert.equal('ENOTFOUND', error.code);
       if ('hostname' in error) {
         // node 4.x+
         assert.equal('some.invalid.thing.', error.hostname);
       }
     });
 });
 it('appends the searchDomain to non-fqdns in baseUrl', function() {
   var options = {
     baseUrl: 'http://some.invalid.thing/a',
     searchDomain: 'bar123',
   };
   return assert.rejects(fetch('/path', options)).then(function(error) {
     assert.equal('ENOTFOUND', error.code);
     if ('hostname' in error) {
       // node 4.x+
       assert.equal('some.invalid.thing.bar123.', error.hostname);
     }
   });
 });
Exemple #3
0
 it('fails with self-signed https', function() {
   return assert.rejects(fetch(options.baseUrlTls)).then(function(error) {
     // In browsers we don't get any nice, reliable errors (yet?)
     if (typeof document === 'undefined') {
       if (error.code) {
         // more recent node versions (e.g. 4+)
         assert.match(/SELF_SIGNED/, error.code);
       } else {
         // old node versions (e.g. 0.10)
         assert.match(/SELF_SIGNED/, error.message);
       }
     }
   });
 });