mashery/iodocs — pull request #66 by capncodewash (2013-01-17 15:36:33+00:00)
Title: @ffejneslen's patch supporting custom JSON and XML request bodies (slightly broken)

Hi there,
This is an attempt to integrate the patch discussed in issue #51 - done by ffejneslen.

The line breaks were wrong in some of their code, so I converted them and merged as cleanly as I could.

The resulting code works for all the demo APIs apart from the one ffejneslen added to demonstrate custom request bodies ('/eventnotification').

The error it gives is:
```
Express
500 TypeError: /Users/graeme/git/iodocs-graeme/views/api.jade:1 > 1| h1=apiInfo.name 2| - if (session.authed && apiInfo.oauth && apiInfo.oauth.type =='three-legged') 3| - var authed ='authed' 4| - else Cannot read property 'name' of undefined
> 1| h1=apiInfo.name
2| - if (session.authed && apiInfo.oauth && apiInfo.oauth.type =='three-legged')
3| - var authed ='authed'
4| - else
Cannot read property 'name' of undefined
at Object.eval (eval at (/Users/graeme/git/iodocs-graeme/node_modules/jade/lib/jade.js:226:10))
at ServerResponse.res._render (/Users/graeme/git/iodocs-graeme/node_modules/express/lib/view.js:425:21)
at ServerResponse.res.render (/Users/graeme/git/iodocs-graeme/node_modules/express/lib/view.js:318:17)
at /Users/graeme/git/iodocs-graeme/app.js:800:9
at callbacks (/Users/graeme/git/iodocs-graeme/node_modules/express/lib/router/index.js:272:11)
at param (/Users/graeme/git/iodocs-graeme/node_modules/express/lib/router/index.js:246:11)
at param (/Users/graeme/git/iodocs-graeme/node_modules/express/lib/router/index.js:243:11)
at pass (/Users/graeme/git/iodocs-graeme/node_modules/express/lib/router/index.js:253:5)
at Router._dispatch (/Users/graeme/git/iodocs-graeme/node_modules/express/lib/router/index.js:280:5)
at Object.middleware [as handle] (/Users/graeme/git/iodocs-graeme/node_modules/express/lib/router/index.js:45:10)
```

I suspect I may have just made a merging error, but it anyone could point out my mistake that'd be most useful.