diff --git a/lib/services/sf.js b/lib/services/sf.js index 0f62776ef..a1b26edfe 100644 --- a/lib/services/sf.js +++ b/lib/services/sf.js @@ -587,10 +587,7 @@ function StateAbstract(options) { const params = requestOptions.params || {}; if (requestOptions.includeGuid) { - // In case of repeated requests for the same request ID, - // the Global UID is added for better traceability. - const guid = uuidv4(); - params[sfParams.paramsNames.SF_REQUEST_GUID] = guid; + addGuidToParams(params); } const realRequestOptions = @@ -733,13 +730,17 @@ function StateAbstract(options) { // pre-process the request options this.preprocessOptions(this.requestOptions); + const params = this.requestOptions.params || {}; + if (this.requestOptions.includeGuid) { + addGuidToParams(params); + } const options = { method: this.requestOptions.method, headers: this.requestOptions.headers, url: this.requestOptions.absoluteUrl, json: this.requestOptions.json, - includeGuid: this.requestOptions.includeGuid, + params: params }; // issue the async http request @@ -747,6 +748,13 @@ function StateAbstract(options) { return await httpClient.requestAsync(options); }; + function addGuidToParams(params) { + // In case of repeated requests for the same request ID, + // the Global UID is added for better traceability. + const guid = uuidv4(); + params[sfParams.paramsNames.SF_REQUEST_GUID] = guid; + } + /** * Sends out the request. *