Extract some common code in http request processing.
Extract some common code in http request processing.

Fixes some subtle bugs:
- the `options' argument is no longer modified
- custom headers in put/post requests are now preserved
- the Content-Type header can now be customized in post requests

wesabe/grendel-ruby