function executeRequest(request, resolve, reject) {
    var clientConfig = request._clientConfig;
    var use_post;
    var allow_retry_post;
    var uri = clientConfig.uri;
    var requests;
    var data;

    if (!uri) {
        uri = clientConfig.cors
            ? request.options.corsPath
            : request.options.xhrPath;
    }

    use_post = request.operation !== OP_READ || clientConfig.post_for_read;
    // We use GET request by default for READ operation, but you can override that behavior
    // by specifying {post_for_read: true} in your request's clientConfig
    if (!use_post) {
        var getUriFn = isFunction(clientConfig.constructGetUri)
            ? clientConfig.constructGetUri
            : defaultConstructGetUri;
        var get_uri = getUriFn.call(
            request,
            uri,
            request.resource,
            request._params,
            clientConfig,
            pickContext(
                request.options.context,
                request.options.contextPicker,
                'GET'
            )
        );
        /* istanbul ignore next */
        if (!get_uri) {
            // If a custom getUriFn returns falsy value, we should run defaultConstructGetUri
            // TODO: Add test for this fallback
            get_uri = defaultConstructGetUri.call(
                request,
                uri,
                request.resource,
                request._params,
                clientConfig,
                request.options.context
            );
        }
        // TODO: Remove `returnMeta` feature flag after next release
        // This feature flag will enable the new return format for GET api requests
        // Whereas before any data from services was returned as is. We now return
        // an object with a data key containing the service response, and a meta key
        // containing the service's metadata response (i.e headers and statusCode).
        // We need this feature flag to be truly backwards compatible because it is
        // concievable that some active browser sessions could have the old version of
        // client fetcher while the server upgrades to the new version. This could be
        // easily fixed by refreshing the browser, but the feature flag will ensure
        // old fetcher clients will receive the old format and the new client will
        // receive the new format
        get_uri += get_uri.indexOf('?') !== -1 ? '&' : '?';
        get_uri += 'returnMeta=true';
        if (get_uri.length <= MAX_URI_LEN) {
            uri = get_uri;
        } else {
            use_post = true;
        }
    }

    var customHeaders = clientConfig.headers || request.options.headers || {};
    if (!use_post) {
        return REST.get(
            uri,
            customHeaders,
            Object.assign(
                { xhrTimeout: request.options.xhrTimeout },
                clientConfig
            ),
            function getDone(err, response) {
                if (err) {
                    return reject(err);
                }
                resolve(parseResponse(response));
            }
        );
    }

    // individual request is also normalized into a request hash to pass to api
    requests = {};
    requests[DEFAULT_GUID] = {
        resource: request.resource,
        operation: request.operation,
        params: request._params,
    };
    if (request._body) {
        requests[DEFAULT_GUID].body = request._body;
    }
    data = {
        requests: requests,
        context: request.options.context,
    }; // TODO: remove. leave here for now for backward compatibility
    uri = request._constructGroupUri(uri);
    allow_retry_post = request.operation === OP_READ;
    return REST.post(
        uri,
        customHeaders,
        data,
        Object.assign(
            {
                unsafeAllowRetry: allow_retry_post,
                xhrTimeout: request.options.xhrTimeout,
            },
            clientConfig
        ),
        function postDone(err, response) {
            if (err) {
                return reject(err);
            }
            var result = parseResponse(response);
            if (result) {
                result = result[DEFAULT_GUID] || {};
            } else {
                result = {};
            }
            resolve(result);
        }
    );
}
/**
 * Execute and resolve/reject this fetcher request
 * @method executeRequest
 * @param {Object} request Request instance object
 * @param {Function} resolve function to call when request fulfilled
 * @param {Function} reject function to call when request rejected
 */
Execute and resolve/reject this fetcher request
@method executeRequest
@param {Object} request Request instance object
@param {Function} resolve function to call when request fulfilled
@param {Function} reject function to call when request rejected
Execute and resolve / reject this fetcher request @method executeRequest @param { Object } request Request instance object @param { Function } resolve function to call when request fulfilled @param { Function } reject function to call when request rejected
function executeRequest(request, resolve, reject) {
    var clientConfig = request._clientConfig;
    var use_post;
    var allow_retry_post;
    var uri = clientConfig.uri;
    var requests;
    var data;
    if (!uri) {
        uri = clientConfig.cors
            ? request.options.corsPath
            : request.options.xhrPath;
    }
    use_post = request.operation !== OP_READ || clientConfig.post_for_read;
    if (!use_post) {
        var getUriFn = isFunction(clientConfig.constructGetUri)
            ? clientConfig.constructGetUri
            : defaultConstructGetUri;
        var get_uri = getUriFn.call(
            request,
            uri,
            request.resource,
            request._params,
            clientConfig,
            pickContext(
                request.options.context,
                request.options.contextPicker,
                'GET'
            )
        );
        if (!get_uri) {
            get_uri = defaultConstructGetUri.call(
                request,
                uri,
                request.resource,
                request._params,
                clientConfig,
                request.options.context
            );
        }
        get_uri += get_uri.indexOf('?') !== -1 ? '&' : '?';
        get_uri += 'returnMeta=true';
        if (get_uri.length <= MAX_URI_LEN) {
            uri = get_uri;
        } else {
            use_post = true;
        }
    }
    var customHeaders = clientConfig.headers || request.options.headers || {};
    if (!use_post) {
        return REST.get(
            uri,
            customHeaders,
            Object.assign(
                { xhrTimeout: request.options.xhrTimeout },
                clientConfig
            ),
            function getDone(err, response) {
                if (err) {
                    return reject(err);
                }
                resolve(parseResponse(response));
            }
        );
    }
    requests = {};
    requests[DEFAULT_GUID] = {
        resource: request.resource,
        operation: request.operation,
        params: request._params,
    };
    if (request._body) {
        requests[DEFAULT_GUID].body = request._body;
    }
    data = {
        requests: requests,
        context: request.options.context,
    }; 
    uri = request._constructGroupUri(uri);
    allow_retry_post = request.operation === OP_READ;
    return REST.post(
        uri,
        customHeaders,
        data,
        Object.assign(
            {
                unsafeAllowRetry: allow_retry_post,
                xhrTimeout: request.options.xhrTimeout,
            },
            clientConfig
        ),
        function postDone(err, response) {
            if (err) {
                return reject(err);
            }
            var result = parseResponse(response);
            if (result) {
                result = result[DEFAULT_GUID] || {};
            } else {
                result = {};
            }
            resolve(result);
        }
    );
}
function executeRequest ( request , resolve , reject ) { var clientConfig = request . _clientConfig ; var use_post ; var allow_retry_post ; var uri = clientConfig . uri ; var requests ; var data ; if ( ! uri ) { uri = clientConfig . cors ? request . options . corsPath : request . options . xhrPath ; } use_post = request . operation !== OP_READ || clientConfig . post_for_read ; if ( ! use_post ) { var getUriFn = isFunction ( clientConfig . constructGetUri ) ? clientConfig . constructGetUri : defaultConstructGetUri ; var get_uri = getUriFn . call ( request , uri , request . resource , request . _params , clientConfig , pickContext ( request . options . context , request . options . contextPicker , 'GET' ) ) ; if ( ! get_uri ) { get_uri = defaultConstructGetUri . call ( request , uri , request . resource , request . _params , clientConfig , request . options . context ) ; } get_uri += get_uri . indexOf ( '?' ) !== - 1 ? '&' : '?' ; get_uri += 'returnMeta=true' ; if ( get_uri . length <= MAX_URI_LEN ) { uri = get_uri ; } else { use_post = true ; } } var customHeaders = clientConfig . headers || request . options . headers || { } ; if ( ! use_post ) { return REST . get ( uri , customHeaders , Object . assign ( { xhrTimeout : request . options . xhrTimeout } , clientConfig ) , function getDone ( err , response ) { if ( err ) { return reject ( err ) ; } resolve ( parseResponse ( response ) ) ; } ) ; } requests = { } ; requests [ DEFAULT_GUID ] = { resource : request . resource , operation : request . operation , params : request . _params , } ; if ( request . _body ) { requests [ DEFAULT_GUID ] . body = request . _body ; } data = { requests : requests , context : request . options . context , } ; uri = request . _constructGroupUri ( uri ) ; allow_retry_post = request . operation === OP_READ ; return REST . post ( uri , customHeaders , data , Object . assign ( { unsafeAllowRetry : allow_retry_post , xhrTimeout : request . options . xhrTimeout , } , clientConfig ) , function postDone ( err , response ) { if ( err ) { return reject ( err ) ; } var result = parseResponse ( response ) ; if ( result ) { result = result [ DEFAULT_GUID ] || { } ; } else { result = { } ; } resolve ( result ) ; } ) ; }
Execute and resolve/reject this fetcher request
 @method executeRequest
 @param {Object} request Request instance object
 @param {Function} resolve function to call when request fulfilled
 @param {Function} reject function to call when request rejected
Execute and resolve / reject this fetcher request @method executeRequest @param { Object } request Request instance object @param { Function } resolve function to call when request fulfilled @param { Function } reject function to call when request rejected
// We use GET request by default for READ operation, but you can override that behavior // by specifying {post_for_read: true} in your request's clientConfig /* istanbul ignore next */ // If a custom getUriFn returns falsy value, we should run defaultConstructGetUri // TODO: Add test for this fallback // TODO: Remove `returnMeta` feature flag after next release // This feature flag will enable the new return format for GET api requests // Whereas before any data from services was returned as is. We now return // an object with a data key containing the service response, and a meta key // containing the service's metadata response (i.e headers and statusCode). // We need this feature flag to be truly backwards compatible because it is // concievable that some active browser sessions could have the old version of // client fetcher while the server upgrades to the new version. This could be // easily fixed by refreshing the browser, but the feature flag will ensure // old fetcher clients will receive the old format and the new client will // receive the new format // individual request is also normalized into a request hash to pass to api // TODO: remove. leave here for now for backward compatibility