Skip to content

Instantly share code, notes, and snippets.

@ahoNerd
Last active November 9, 2022 08:24
Show Gist options
  • Save ahoNerd/3b594307db295ed81f7afed5bbc765fb to your computer and use it in GitHub Desktop.
Save ahoNerd/3b594307db295ed81f7afed5bbc765fb to your computer and use it in GitHub Desktop.
fetch PUT
class AhoHTTP {
async put(url: RequestInfo | URL, data: any) {
const response = await fetch(url, {
method: 'PUT',
headers: {
'Content-type': 'application/json',
},
body: JSON.stringify(data),
})
const resData = await response.json()
return resData
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment