Add the rack middleware for custom methods to the document