From 892783d3b80837430177085d926efacbc38e46f4 Mon Sep 17 00:00:00 2001 From: Pablo Palacios Date: Wed, 17 Jul 2024 00:27:09 +0200 Subject: [PATCH] fix: make options optional in fetchr client just as in server (#514) --- libs/fetcher.client.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libs/fetcher.client.js b/libs/fetcher.client.js index d9e9e2f..d7397ff 100644 --- a/libs/fetcher.client.js +++ b/libs/fetcher.client.js @@ -174,19 +174,19 @@ Request.prototype.end = function (callback) { * the stats object, which contains resource, operation, params (request params), * statusCode, err, and time (elapsed time) */ - function Fetcher(options) { + var opts = options || {}; this._serviceMeta = []; this.options = { - headers: options.headers, - xhrPath: options.xhrPath || DEFAULT_PATH, - xhrTimeout: options.xhrTimeout || DEFAULT_TIMEOUT, - corsPath: options.corsPath, - context: options.context || {}, - contextPicker: options.contextPicker || {}, - retry: options.retry || null, - statsCollector: options.statsCollector, - unsafeAllowRetry: Boolean(options.unsafeAllowRetry), + headers: opts.headers, + xhrPath: opts.xhrPath || DEFAULT_PATH, + xhrTimeout: opts.xhrTimeout || DEFAULT_TIMEOUT, + corsPath: opts.corsPath, + context: opts.context || {}, + contextPicker: opts.contextPicker || {}, + retry: opts.retry || null, + statsCollector: opts.statsCollector, + unsafeAllowRetry: Boolean(opts.unsafeAllowRetry), _serviceMeta: this._serviceMeta, }; }