Forum: Ruby on Rails How to add these headers to a xml 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.
13d7a3ab12ec57e0d372d7115362cb91?d=identicon&s=25 comopasta Gr (comopasta)
on 2009-06-08 12:43
Hi,

I need to create something like this:

<?xml version="1.0" encoding="UTF-8"?>
<Container>
  <id>aQlfVHX+qPM</id>
  <lifetime>2009-09-19T08:14:55Z</lifetime>
</Container>

The response should contain the next headers:

Content-Type=`application/vnd.3gpp+xml`
Authentication-Info={rspauth=`xxxxxxxxxxx...xxxxxxxxxxx`,qop=`auth-int`,cnonce=`xxxxxxxxxxxxxxxxxx....xxxxxxxxxxxxx`,nc=`000
00001`}

How can I do that?

I always see {"Cache-Control"=>"no-cache",
"Content-Type"=>"application/xml"}
when I print the headers...

I can use xml builder ok to generate the xml, but I have the problem
with the headers.

Thanks.
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2009-06-08 13:02
(Received via mailing list)
On Jun 8, 11:43 am, comopasta Gr <rails-mailing-l...@andreas-s.net>
wrote:
> The response should contain the next headers:
>
> Content-Type=`application/vnd.3gpp+xml`
> Authentication-Info={rspauth=`xxxxxxxxxxx...xxxxxxxxxxx`,qop=`auth-int`,cno 
nce=`xxxxxxxxxxxxxxxxxx....xxxxxxxxxxxxx`,nc=`000
> 00001`}
>

You should just be able to set headers['foo'] in your controller.

Fred
13d7a3ab12ec57e0d372d7115362cb91?d=identicon&s=25 comopasta Gr (comopasta)
on 2009-06-08 14:35
>
> You should just be able to set headers['foo'] in your controller.
>
> Fred

Thanks Fred!
Yeah I've tried several ways. Now I've managed to get:

{"Cache-Control"=>"no-cache",
"Authentication-info"=>"rspauth=`xxxxxxxxxxx...xxxxxxxxxxx`,qop=`auth-int`,cnonce=`xxxxxxxxxxxxxxxxxx....xxxxxxxxxxxxx`,nc=`00000001`",
"Content-Type"=>"application/xml"}

I still have problems with the content-type and getting rid of
cache-control headers.

For the content-type I've tried:

response.content_type = "xxxx" and headers['Content-type'] = "xxxx" but
still get always the "default" one. Haven't yet really tried to get rid
of the cache-control.

The response is generated like:

respond_to do |format|
      format.xml
end

Thanks.
This topic is locked and can not be replied to.