Forum: Ruby on Rails Set HTTP headers on response?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jeff J. (Guest)
on 2006-02-17 19:35
Is it possible to set HTTP headers for a response?

Seeing as you can access the headers using the request.env["FOO"] I am
wondering if there is an equivalent response.env["BAR"], this is a wild
guess and I have seen no documentation to back it up.

Has anyone managed to do this somehow?

Thanks

Jeff
Mikkel B. (Guest)
on 2006-02-17 20:22
(Received via mailing list)
On Friday, February 17, 2006, at 6:35 PM, Jeff J. wrote:
>Jeff
>


@headers["foo"]="bar" is the shiznit...

Mikkel B.

www.strongside.dk    - Football Portal(DK)
nflfeed.helenius.org - Football News(DK)
ting.minline.dk      - Buy Old Stuff!(DK)
Brian V. Hughes (Guest)
on 2006-02-17 20:31
(Received via mailing list)
Jeff J. wrote:
> Is it possible to set HTTP headers for a response?

Of course... what you want to use is the headers hash, it works similar
to
params and session.

i.e.
   headers["Code"] = 404
   headers["Content-Type"] = "text/plain"
etc.

-Brian
This topic is locked and can not be replied to.