codegangsta/martini — pull request #164 by juniorrobot (2014-02-03 15:43:12+00:00)
Title: Fix Content-Type for HTML output from Recovery middleware

The Recovery handler cannot rely on the `Content-Type` header for a response
being correct without explicitly setting it.

Absent setting the header, several cases can lead to undesirable results:
* the `Content-Type` header has already been set to something else
* e.g. `application/json` by the Encoder middleware
* a custom `ResponseWriter` does something unexpected in the `Write` call
* e.g. the GZIP middleware uses `http.DetectContentType`, which
doesn't lead to `text/html` in all cases

This addresses the issue & updates tests. It also reorders the call to `WriteHeader`
to occur *after* the `Content-Type` header is set, per [the docs](http://golang.org/pkg/net/http/#ResponseWriter).