4 ms·
> 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://
by stirner 8y ago
> 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/0ddc96f95eecab4e8aa8dd53bcc70661 https://gist.github.com/geetotes/0ddc96f95eecab4e8aa8dd53bcc...
[2] https://gist.github.com/wwalexander/febbc1ba76c8eafa9f94f5cb2573b34d https://gist.github.com/wwalexander/febbc1ba76c8eafa9f94f5cb...
- joshmn 8y agoHere's[1] a two-liner with Rack [1] https://gist.github.com/joshmn/66f715c65bc19784f95a0e2ce3c9df93 https://gist.github.com/joshmn/66f715c65bc19784f95a0e2ce3c9d...
- andymcsherry 8y agoIt’s a bit disingenuous to call it that. 140 characters on one line that most people would format very differently.
- audiolion 8y agofurthermore I have never used Go or Ruby, but I could easily read and understand the Go code, I have zero idea what the Runy code is doing, or why they do this [-3, 3] seemingly multi dimensional negative array access
- quickthrower2 8y agoI'd say this comment is a tad unfair. Most "one liners" fall under the category "most people would format very differently" And this one at only 140 chars (a classic tweet)
- x4r3m 8y agotwo lines and a big dependency...