Get an endpoint status and statusText
One script reply has been approved by the moderators Verified
Created by admin 1254 days ago Picked 30 times
Submitted by admin Deno
Verified 358 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