Kodes

After creating rewriter I received a request at work asking if there was a simple way to test errors views on the front-end code we do at Betfair. As I did not have any real idea at the time, I wrote a dead simple ruby application hosted on my machine to return an HTTP error code, so the front-end would display the correct error messages. It seemed it was a good idea and I improved it by creating kodes.

Access kodes

Kodes is a simple pure ruby application running on

Sinatra and hosted, once again on heroku. As it says on the tin: kodes is a simple service that allows you to test that your applications handle HTTP response codes properly.

So all you have to do is to send a request to http://kodes.ekynoxe.com/k/<your-code> and it *should* return the corresponding HTTP status code in the response, along with a description of the code itself, as per the HTTP/1.1 specifications.

Now, I say *should* because some status codes like the 1xx family simply instruct browsers to keep going with a request. All browsers should comply with this and not do anything until another response like a 2xx or 4xx is received. The bad news is that you won’t see a snazzy description page like this one for the 306 code (unused!), but if you use curl (or any other http request library that is NOT a browser), you should see the response with the correct status code:

$ curl -0v http://kodes.ekynoxe.com/k/306

Also, the code is hosted on github at https://github.com/ekynoxe/kodes

I hope this is as helpful to you that it is to our teams of developers here! Enjoy.

comments

  • IvanDM Tue, 03 May 2011 - 13:18

    Unsued? ;)

  • Matt Tue, 03 May 2011 - 14:17

    Woops! Corrected =) Thks

Comments are disabled temporarily until I find a suitable system, but you can still send a comment by email and I'll add it to this post. Thanks!