Monday, 2 April 2012

TwitchErorr - HTTP Response Codes On Demand

A few months ago at work, I needed an external server to throw HTTP 500 errors at me under my own control to test a feature on a transparent HTTP proxy.

It seemed like such a simple tool. Simple enough that you'd expect there to be dozens of implementations available. Just a server that would take a number as GET parameter, and reply with that error number. Perhaps my Google - foo just sucks, but I couldn't find one anywhere. So I wrote a quick app-engine script to throw 500 errors back at me and figured this must be some really unusual task.

Today, however, I needed a similar server, except it had to throw any 50X error. So I modified that script to do it, and now I'm wondering if anyone else out there could use this server. And if I need something twice, then that probably means that someone else out there is going to need it at least once.

So, I gave it a smart-ass name and I've posted it on Github (check out TwitchErorr).

Right now, it's just a crappy App Engine python script that can only throw 50X errors, but I'd rather re-write it in node.js and be able to throw any logical HTTP server-side error. I only wrote it in App Engine because I didn't have a Heroku account set up at the time and I needed that test done soon, but since this blog post is longer than the script it's self, perhaps this deserves a proper re-write. (I might hack that out a little later tonight)

It's currently live at http://twitcherorr.appspot.com/error=501, just replace the parameter with any 50X number. More documentation and features are coming soon.

No comments:

Post a Comment