Forum: Ruby on Rails accessing http raw post data?

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.
5e8fd591aeccbffd6fc93c171ac4fa43?d=identicon&s=25 Aaron Smith (warhero)
on 2007-06-30 05:09
how can I access http raw post data in a controller?
525128e48ca2b4c7fb6176ea166fccfd?d=identicon&s=25 Eric G. (gotskill10)
on 2007-06-30 06:25
I believe that raw post data is kept in the request headers of a
response, so you want to access the request object.

Something like this should do:

request.env['RAW_POST_DATA']

Is that what you were looking for?
5e8fd591aeccbffd6fc93c171ac4fa43?d=identicon&s=25 Aaron Smith (warhero)
on 2007-06-30 06:56
Aryk Grosz wrote:
> I believe that raw post data is kept in the request headers of a
> response, so you want to access the request object.
>
> Something like this should do:
>
> request.env['RAW_POST_DATA']
>
> Is that what you were looking for?


Yep. thats it. Do you know if this is altered in any way before it's put
into the environment table?
5e8fd591aeccbffd6fc93c171ac4fa43?d=identicon&s=25 Aaron Smith (warhero)
on 2007-06-30 06:58
Aaron Smith wrote:
> Aryk Grosz wrote:
>> I believe that raw post data is kept in the request headers of a
>> response, so you want to access the request object.
>>
>> Something like this should do:
>>
>> request.env['RAW_POST_DATA']
>>
>> Is that what you were looking for?
>
>
> Yep. thats it. Do you know if this is altered in any way before it's put
> into the environment table?

More info...

in a generic webrick handler. the raw data i'm looking for comes in like
this:

def MyWeb < WEBrick::HTTPServlet::AbstractServlet
def doGet(request,response)
 raw = request.body
end

def doPost(request,response)
 raw = request.body
end
end

in each method the raw data is in request.body. is
request.env['RAW_POST_DATA'] the same as the above?

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