The set_headers() method sets headers of the http response: things like mime type. As you observed, it does not change the actual content of the response. It *is* possible to do what you want by rendering the body, collecting the header requirements as you go, and then wrapping the the headers around the body. This is entirely under the control of your rendering function. Also, you may want to look at quixote.form2.Form._render_javascript(), if you are talking about Forms.