async function fetchSessionToken(url, config) {
  await delay(5);

  const requestUrl = new URL(url);
  if (requestUrl.searchParams.get('key') !== validKey) {
    const response = new Response(
      JSON.stringify({
        error: {message: 'API key not valid. Please pass a valid API key.'},
      }),
      {status: 400},
    );
    return Promise.resolve(response);
  }

  /**
   * @type {import("../../../../../src/ol/source/Google").SessionTokenRequest}
   */
  const requestBody = JSON.parse(config.body);

  /**
   * @type {import("../../../../../src/ol/source/Google").SessionTokenResponse}
   */
  const responseBody = {
    session: sessionId,
    expiry: Math.floor(600 + Date.now() / 1000).toString(),
    tileWidth: 256,
    tileHeight: 256,
    imageFormat: requestBody.imageFormat || 'png',
  };

  const response = new Response(JSON.stringify(responseBody), {
    status: 200,
    headers: {
      'Content-Type': 'application/json',
    },
  });
  return Promise.resolve(response);
}
@param {string} url URL.
@param {RequestInit} config Config.
@return {Promise<Response>} A promise that resolves with the response.