Accessing http raw post data?

how can I access http raw post data in a controller?

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?

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. 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.