diff --git a/lib/agent.js b/lib/agent.js index 8adf984..1b4aa27 100644 --- a/lib/agent.js +++ b/lib/agent.js @@ -20,12 +20,7 @@ const Test = require('./test.js'); function TestAgent(app, options) { if (!(this instanceof TestAgent)) return new TestAgent(app, options); if (typeof app === 'function') app = http.createServer(app); // eslint-disable-line no-param-reassign - if (options) { - this._ca = options.ca; - this._key = options.key; - this._cert = options.cert; - } - Agent.call(this); + Agent.call(this, options); this.app = app; } @@ -45,9 +40,7 @@ TestAgent.prototype.host = function(host) { methods.forEach(function(method) { TestAgent.prototype[method] = function(url, fn) { // eslint-disable-line no-unused-vars const req = new Test(this.app, method.toUpperCase(), url, this._host); - req.ca(this._ca); - req.cert(this._cert); - req.key(this._key); + if (this._host) { req.set('host', this._host); }