Browse Source

add spdy agent

http2
Vsevolod Strukchinsky 9 years ago
parent
commit
d405b3d98b
  1. 8
      index.js
  2. 1
      package.json

8
index.js

@ -18,6 +18,7 @@ const createErrorClass = require('create-error-class');
const nodeStatusCodes = require('node-status-codes'); const nodeStatusCodes = require('node-status-codes');
const isPlainObj = require('is-plain-obj'); const isPlainObj = require('is-plain-obj');
const isRetryAllowed = require('is-retry-allowed'); const isRetryAllowed = require('is-retry-allowed');
const spdy = require('spdy');
function requestAsEventEmitter(opts) { function requestAsEventEmitter(opts) {
opts = 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; return opts;
} }

1
package.json

@ -54,6 +54,7 @@
"is-stream": "^1.0.0", "is-stream": "^1.0.0",
"lowercase-keys": "^1.0.0", "lowercase-keys": "^1.0.0",
"node-status-codes": "^2.0.0", "node-status-codes": "^2.0.0",
"spdy": "^3.2.0",
"timed-out": "^2.0.0", "timed-out": "^2.0.0",
"unzip-response": "^1.0.0", "unzip-response": "^1.0.0",
"url-parse-lax": "^1.0.0" "url-parse-lax": "^1.0.0"

Loading…
Cancel
Save