Edits history of script submission #22424 for ' Get an endpoint status and statusText (http)'

  • bunnative
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    
    export async function main(endpoint: string) {
      try {
        const res = await fetch(endpoint);
        return { status: res.status, statusText: res.statusText };
      } catch (e) {
        return { status: -1, statusText: e.toString() };
      }
    }
    

    Submitted by hugo989 14 days ago