httpstat.us Documentation

repository·main·Indexed 21 days ago

https://github.com/aaronpowell/httpstatus

A service for testing how applications handle various HTTP status codes by returning a requested status code in response to a URL. Includes instructions for using the hosted service and self-hosting via Docker using the GitHub Packages container image.

Tokens
307
Snippets
2
Records
2
Agent score
24%

What's inside httpstat.us

  1. Self-host httpstat.us using Docker

    main

    If you need to test HTTP status codes that are not available on the hosted version, or if you require timeouts longer than what the hosted service supports, you can self-host the service.

    The service is available as a container image on GitHub Packages.

    https://github.com/aaronpowell/httpstatus/pkgs/container/httpstatus
  2. Test HTTP status codes with httpstat.us

    main

    You can test how your application handles different HTTP status codes by pointing your requests to https://httpstat.us/ followed by the desired status code. The service will respond with that specific status code.

    For example, to test how your application handles a 500 Internal Server Error, request https://httpstat.us/500.

    async function getData(url) {
      const res = await fetch(url);
    
      if (!res.ok) {
        throw new Error("Failed to get data");
      }
      return await res.json();
    }
    
    getData("https://httpstat.us/500").then(console.log).catch(console.error);