I made a rails 3 rack middleware to log users actions with request = Rack::Request.new(env)
.
So i send to my database the request.fullpath
and request.user_agent
, as detailed below:
My issue appears I want to get the POST response too (to get ids, people name extracted from the JSON payload ...).
So i get the response = Rack::Response.new(request.path)
. But when i print response.body
, i have only my request.path
, and the request.params
does not contain anything ...
By looking at the response with Firebug, I can see all the data I want.
Thanks for your responses.
Problem resolved !
I finally add status, headers, body = @app.call(env)
to my middleware and send the body
variable to my service. For each POST request, body
contains all the post response I want.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.