async fetch()

in follow_origin_302/src/index.js [5:17]


  async fetch(request) {
    // Fetch origin server
    const response = await fetch(request, { redirect: "manual" });
    const status = response.status;

    // If status is 302, fetch the redirected location
    if (status === 302) {
      const res = await fetch(response.headers.get("Location"));
      return res;
    }

    return response;
  },