Skip to content

Commit

Permalink
Added timeout as an additional parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
eumpek committed Mar 11, 2019
1 parent 978458a commit a10be4a
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions dist/lib/apiGatewayCore/apiGatewayClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ apiGatewayClientFactory.newClient = function (simpleHttpClientConfig, sigV4Clien
// merge them into the appropriate request properties
request.headers = _utils2.default.mergeInto(request.headers, additionalParams.headers);
request.queryParams = _utils2.default.mergeInto(request.queryParams, additionalParams.queryParams);
request.timeout = _utils2.default.mergeInto(request.timeout, additionalParams.timeout);

// If an auth type was specified inject the appropriate auth client
if (authType === 'AWS_IAM') {
Expand Down
7 changes: 7 additions & 0 deletions dist/lib/apiGatewayCore/sigV4Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,15 @@ sigV4ClientFactory.newClient = function (config) {
var verb = _utils2.default.assertDefined(request.verb, 'verb');
var path = _utils2.default.assertDefined(request.path, 'path');
var queryParams = _utils2.default.copy(request.queryParams);
var timeout = _utils2.default.copy(request.timeout);

if (queryParams === undefined) {
queryParams = {};
}

if (timeout === undefined) {
timeout = 0;
}
var headers = _utils2.default.copy(request.headers);
if (headers === undefined) {
headers = {};
Expand Down Expand Up @@ -240,6 +246,7 @@ sigV4ClientFactory.newClient = function (config) {

var signedRequest = {
headers: headers,
timeout: timeout,
data: body
};
if (config.retries !== undefined) {
Expand Down
5 changes: 5 additions & 0 deletions dist/lib/apiGatewayCore/simpleHttpClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,13 @@ simpleHttpClientFactory.newClient = function (config) {
var verb = _utils2.default.assertDefined(request.verb, 'verb');
var path = _utils2.default.assertDefined(request.path, 'path');
var queryParams = _utils2.default.copy(request.queryParams);
var timeout = _utils2.default.copy(request.timeout);
if (queryParams === undefined) {
queryParams = {};
}
if (timeout === undefined) {
timeout = 0;
}
var headers = _extends({}, _utils2.default.copy(request.headers), config.headers);

// If the user has not specified an override for Content type the use default
Expand All @@ -84,6 +88,7 @@ simpleHttpClientFactory.newClient = function (config) {

var simpleHttpRequest = {
headers: headers,
timeout: timeout,
data: body
};
if (config.retries !== undefined) {
Expand Down
1 change: 1 addition & 0 deletions src/apigClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ apigClientFactory.newClient = (config = {}) => {
verb: method.toUpperCase(),
path: pathComponent + uritemplate.parse(pathTemplate).expand(params),
headers: additionalParams.headers || {},
timeout: additionalParams.timeout || 0,
queryParams: additionalParams.queryParams,
body: body
};
Expand Down
1 change: 1 addition & 0 deletions src/lib/apiGatewayCore/apiGatewayClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ apiGatewayClientFactory.newClient = function(simpleHttpClientConfig, sigV4Client
// merge them into the appropriate request properties
request.headers = utils.mergeInto(request.headers, additionalParams.headers);
request.queryParams = utils.mergeInto(request.queryParams, additionalParams.queryParams);
request.timeout = utils.mergeInto(request.timeout, additionalParams.timeout);

// If an auth type was specified inject the appropriate auth client
if (authType === 'AWS_IAM') {
Expand Down
7 changes: 7 additions & 0 deletions src/lib/apiGatewayCore/sigV4Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,15 @@ sigV4ClientFactory.newClient = function(config) {
let verb = utils.assertDefined(request.verb, 'verb');
let path = utils.assertDefined(request.path, 'path');
let queryParams = utils.copy(request.queryParams);
let timeout = utils.copy(request.timeout);

if (queryParams === undefined) {
queryParams = {};
}

if (timeout === undefined) {
timeout = 0;
}
let headers = utils.copy(request.headers);
if (headers === undefined) {
headers = {};
Expand Down Expand Up @@ -241,6 +247,7 @@ sigV4ClientFactory.newClient = function(config) {

let signedRequest = {
headers: headers,
timeout: timeout,
data: body
};
if (config.retries !== undefined) {
Expand Down
5 changes: 5 additions & 0 deletions src/lib/apiGatewayCore/simpleHttpClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,13 @@ simpleHttpClientFactory.newClient = (config) => {
let verb = utils.assertDefined(request.verb, 'verb');
let path = utils.assertDefined(request.path, 'path');
let queryParams = utils.copy(request.queryParams);
let timeout = utils.copy(request.timeout);
if (queryParams === undefined) {
queryParams = {};
}
if (timeout === undefined) {
timeout = 0;
}
let headers = {...utils.copy(request.headers), ...config.headers};

// If the user has not specified an override for Content type the use default
Expand All @@ -69,6 +73,7 @@ simpleHttpClientFactory.newClient = (config) => {

let simpleHttpRequest = {
headers: headers,
timeout: timeout,
data: body
};
if (config.retries !== undefined) {
Expand Down

0 comments on commit a10be4a

Please sign in to comment.