aboutsummaryrefslogtreecommitdiff
path: root/src/node-fallbacks/@vercel_fetch.js
blob: 95314ba9e9546bd0cb8f9454bd01b7b5389b0012 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// This is just a no-op. Intent is to prevent importing a bunch of stuff that isn't relevant.
module.exports = (
  wrapper = "Bun" in globalThis ? Bun.fetch : globalThis.fetch
) => {
  async function vercelFetch(url, opts = {}) {
    // Convert Object bodies to JSON if they are JS objects
    if (
      opts.body &&
      typeof opts.body === "object" &&
      (!("buffer" in opts.body) ||
        typeof opts.body.buffer !== "object" ||
        !(opts.body.buffer instanceof ArrayBuffer))
    ) {
      opts.body = JSON.stringify(opts.body);
      // Content length will automatically be set
      if (!opts.headers) opts.headers = new Headers();

      opts.headers.set("Content-Type", "application/json");
    }

    try {
      return await wrapper(url, opts);
    } catch (err) {
      if (typeof err === "string") {
        err = new Error(err);
      }

      err.url = url;
      err.opts = opts;
      throw err;
    }
  }

  vercelFetch.default = vercelFetch;
  return vercelFetch;
};
'sub'>Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/examples/framework-vue/astro.config.mjs (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2024-03-28[ci] formatGravatar TK 1-2/+2
2024-03-28feat: allow dynamic route segments in isr.exclude array (#10513)Gravatar TK 5-3/+69
* Allow dynamic route segments in isr.exclude array * copy over eslint-disable as well * add test * update test: slashes dont need to be escaped * update changeset --------- Co-authored-by: lilnasy <69170106+lilnasy@users.noreply.github.com>
2024-03-28[ci] formatGravatar Houston (Bot) 2-3/+3
2024-03-28[ci] release (#10597)Gravatar Houston (Bot) 37-66/+89
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-03-28db: Rework index config with generated index names (#10589)Gravatar Ben Holmes 6-68/+344
* feat: add indexes array config with name gen * fix: add _idx suffix, remove name from output * feat(test): new index config * chore: remove unused type * chore: changeset * chore: add sort() for consistent names * feat(test): consistent column ordering * feat(test): ensure no queries when migrating legacy to new