function getResponse(url, method, data) {
    url =
        url.replace(apiBaseUrl, '')
            .replace(
                `${apiVersion.VERSION}/projects/${apiclient.DEFAULT_PROJECT_}/`,
                '');
    let response;
    if (url in calls) {
      response = calls[url];
    } else {
      throw new Error(url + ' mock response not specified');
    }
    if (typeof response === 'function') {
      response = response(url, method, data);
    }
    if (typeof response === 'string') {
      response = {
        'text': response,
        'status': 200,
        'contentType': 'application/json; charset=utf-8'
      };
    }
    if (typeof response.text !== 'string') {
      throw new Error(url + ' mock response missing/invalid text');
    }

    if (typeof response.status !== 'number' &&
        typeof response.status !== 'function') {
      throw new Error(url + ' mock response missing/invalid status');
    }
    return response;
  }
Mock the networking calls used in send.

TODO(user): Make the global patching done here reversible.

@param {!Object=} calls A dictionary containing the responses to return
    for each URL, keyed to URL.