From cff2a9883c1a08b39ca0b95f12c102d7dcaab4c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rene=CC=81=20Kretzschmar?= Date: Mon, 27 Apr 2020 17:05:46 +0200 Subject: [PATCH] Replace mock agent by real http.Agent with arbitrary options --- src/index.test.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/index.test.js b/src/index.test.js index a8e77d6..e7f38d8 100644 --- a/src/index.test.js +++ b/src/index.test.js @@ -1,3 +1,5 @@ +const http = require('http') + const test = require('ava') const fromString = require('from2-string') const { TextHTTPError, JSONHTTPError } = require('micro-api-client') @@ -12,7 +14,13 @@ const pathPrefix = '/api/v10' const host = `${domain}:${port}` const origin = `${scheme}://${host}` const accessToken = 'testAccessToken' -const agent = { key: 'value' } +const agent = new http.Agent({ + keepAlive: true, + keepAliveMsecs: 60000, + maxSockets: 10, + maxFreeSockets: 10, + timeout: 60000 +}) const getClient = function(opts = {}) { return new NetlifyAPI(opts.accessToken, Object.assign({ scheme, host, pathPrefix }, opts))