from Hacker News

Show HN: HTTP Status as a Service

by gee_totes on 6/5/18, 2:55 AM with 44 comments

  • by stirner on 6/5/18, 5:53 AM

    > status.icu will return whatever https status code you want! Use a GET request to any status.icu path to guarantee an HTTP status code.

        $ curl -I https://status.icu/418/
        HTTP/1.1 500 Internal Server Error 
    
    The Nginx configuration responsible for the service[1] just hardcodes a handful of common HTTP status codes. A Go version that supports any status code takes fewer lines than status.icu's nginx.conf, even after gofmt.[2] Not that I think anyone should be relying on a third-party service for "writing browser integration tests" OR "mocking API responses".

    [1] https://gist.github.com/geetotes/0ddc96f95eecab4e8aa8dd53bcc...

    [2] https://gist.github.com/wwalexander/febbc1ba76c8eafa9f94f5cb...

  • by tlrobinson on 6/5/18, 5:49 AM

        require("express")().get("/:status", (req, res) => res.status(req.params.status).end()).listen(80)
  • by hamandcheese on 6/5/18, 4:33 AM

    See also: httpbin, which comes with a ton of other handy features as well.

    http://httpbin.org/#/Status_codes

  • by xurukefi on 6/5/18, 7:16 AM

    There is an XSS vuln on the website. Try entering something like '<b>test</b>' or '<script>alert('test');</script>" into the text box.
  • by dmlittle on 6/5/18, 4:11 AM

    I built something similar about a year ago experimenting with AWS's API Gateway. https://mock.codes/ The landing page is an S3 file, and everything is just API Gateway configs.

    There used to be a similar service hosted on the same domain that eventually went dead. I bought the domain and brought up this service again. It barely gets used (haven't checked usage in a while) but I've already paid for the domain and it costs me pennies to keep it up and running.

  • by Gobd on 6/5/18, 3:54 AM

    I've used https://httpstat.us/ which seems to offer the same features plus configurable delay, although when you hit it 3,000 times a second it doesn't necessarily respond with the code you ask for.
  • by Boulth on 6/5/18, 5:52 AM

  • by Fej on 6/5/18, 4:38 AM

    Does not support IoT kettles. Fatal flaw.

    (Response code 418.)

  • by fluxsauce on 6/5/18, 3:48 AM

    Neat! I wrote a similar project for Drupal once - https://www.drupal.org/project/generate_errors - I found it to be a good way to learn about HTTP status codes and their meanings. Currently, you've got a finite list of HTTP status codes and don't have definitions. You may want to consider grouping them and including labels. Or don't, I'm just some guy on the internet :-)

    Cool project!

  • by dweekly on 6/5/18, 4:07 AM

    https://status.party/422/ is NXDOMAIN, not sure that was the error you intended. ;-)
  • by quickthrower2 on 6/5/18, 10:43 AM

    :-( No teapot support (418)
  • by greglindahl on 6/5/18, 5:02 AM

    Arbitrary status codes from your webserver is extremely useful for testing your nginx or other reverse-proxy configuration. If your webserver is returning 500s, does nginx retry in an infinite loop? Not good!

    Better: if a query causes your webserver to crash, does nginx crash ALL of them while retrying that bad query? :-)

  • by sirsuki on 6/5/18, 4:39 AM

    No CORS support. That seems silly.
  • by Walkman on 6/5/18, 6:26 AM

    why on earth would I want this instead of a local service if I absolutely need (which I don't with clean architecture and clean code)
  • by alex_suzuki on 6/5/18, 6:02 AM

    httpbin is way more powerful than this...

    https://httpbin.org/

  • by 7ewis on 6/5/18, 9:29 AM

    Pretty useful. Was writing a script yesterday to log website availability including the HTTP status of the site.

    This will be useful to make sure my script works correctly!

  • by doughj3 on 6/5/18, 4:22 AM

    Should add 204, useful for frame-busting busting: https://blog.codinghorror.com/we-done-been-framed/
  • by est on 6/5/18, 3:47 AM

    wait, .icu is a tld??
  • by hidiegomariani on 6/5/18, 8:46 AM

    I wonder what is the incentive to keep it up and running
  • by avip on 6/5/18, 10:54 AM

    For developers who never heard of httpbin.org
  • by anonlastname on 6/5/18, 5:19 PM

    Sounds exactly like httpstat.us