Return custom http responses from a controller?


#1

Is it possible to have a response to the browser triggered prematurely
in a controller? like before rails does all it’s internal processing?

also if so can I change the content-type for the response?

thanks


#2

Aaron S. wrote:

Is it possible to have a response to the browser triggered prematurely
in a controller? like before rails does all it’s internal processing?

also if so can I change the content-type for the response?

thanks

Also, besides the content-type, how can I supply a custom response body?


#3

On 6/29/07, Aaron S. removed_email_address@domain.invalid wrote:

Aaron S. wrote:

Is it possible to have a response to the browser triggered prematurely
in a controller? like before rails does all it’s internal processing?

also if so can I change the content-type for the response?

thanks

Also, besides the content-type, how can I supply a custom response body?

render is what supplies the response body. There are just more ways
to render then you are aware of. render :text => ‘test’, render
:file =>file, render_xml, etc…

To set headers do this before rendering:

headers[“Content-Type”] = ‘mycontenttype’

Chris


#4

perfect. thanks.