0
Send PUT Request
One script reply has been approved by the moderators Verified
Created by maximelambercier 688 days ago Viewed 5289 times
0
Submitted by jaller94 Deno
Verified 624 days ago
1
export async function main(url: string, body: object = {}) {
2
  const resp = await fetch(url, {
3
    method: "PUT",
4
    headers: {
5
      "Content-Type": "application/json",
6
    },
7
    body: JSON.stringify(body),
8
  });
9

10
  return {
11
    ok: resp.ok,
12
    status: resp.status,
13
    text: await resp.text(),
14
  };
15
}
16

Other submissions