From d405b3d98b12c777fd865a174404873edd121ae9 Mon Sep 17 00:00:00 2001 From: Vsevolod Strukchinsky Date: Wed, 10 Feb 2016 13:02:36 +0500 Subject: [PATCH] add spdy agent --- index.js | 8 ++++++++ package.json | 1 + 2 files changed, 9 insertions(+) diff --git a/index.js b/index.js index 2081c58..d18114e 100644 --- a/index.js +++ b/index.js @@ -18,6 +18,7 @@ const createErrorClass = require('create-error-class'); const nodeStatusCodes = require('node-status-codes'); const isPlainObj = require('is-plain-obj'); const isRetryAllowed = require('is-retry-allowed'); +const spdy = require('spdy'); function requestAsEventEmitter(opts) { opts = opts || {}; @@ -267,6 +268,13 @@ function normalizeArguments(url, opts) { }; } + if (opts.agent === undefined) { + opts.agent = spdy.createAgent({ + host: opts.host, + port: opts.port + }); + } + return opts; } diff --git a/package.json b/package.json index c65e213..4837f6b 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,7 @@ "is-stream": "^1.0.0", "lowercase-keys": "^1.0.0", "node-status-codes": "^2.0.0", + "spdy": "^3.2.0", "timed-out": "^2.0.0", "unzip-response": "^1.0.0", "url-parse-lax": "^1.0.0"