0
Get an endpoint status and statusText
One script reply has been approved by the moderators Verified
Created by admin 729 days ago Viewed 77830 times
0
Submitted by admin Deno
Verified 729 days ago
1
export async function main(endpoint: string) {
2
  try {
3
    const res = await fetch(endpoint);
4
    return { status: res.status, statusText: res.statusText };
5
  } catch (e) {
6
    return { status: -1, statusText: e.toString() };
7
  }
8
}
9