Add middleware to handle JSON requests

In order for sinatra to handle JSON requests properly by adding the body to the params, we must use some middleware to parse JSON type requests. This middleware is taken from the rack-contrib gem and should be replaced by the gem in the future. Currently the latest stable release does not contain this code and this is taken directly from master.