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.
Aaron S. (Guest)
on 2007-06-30 07:09
how can I access http raw post data in a controller?
Eric G. (Guest)
on 2007-06-30 08: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?
Aaron S. (Guest)
on 2007-06-30 08:56
Aryk G. 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?
Aaron S. (Guest)
on 2007-06-30 08:58
Aaron S. wrote:
> Aryk G. 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.