Send PUT Request

Script http Verified

by maximelambercier ยท 6/6/2022

The script

Submitted by jaller94 Deno
Verified 386 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
  • Submitted by rossmccrann Deno
    Created 1421 days ago
    1
    export async function main(url: string, body: object) {
    2
    
    
    3
        let resp = await fetch(url, {
    4
            method: "PUT",
    5
            headers: {
    6
                "Content-Type": "application/json",
    7
            },
    8
            body,
    9
            });
    10
    
    
    11
    	return { "response": await resp.text() }
    12
    }