Move content setting to .write_* methods on BaseHandler.
Add tests for content type on all .write_* methods.