Ruby with EventMachine: How to get the body result automatically of the last_effective_url -


i have 'post' redirect 'get' in eventmachine using 'redirect =>1' redirect automatically.

what 'post' redirect 'get' how can redirect automatically obtain latest url response (the 1 of last url, last_effective_url)

should call(last_effective_url) inside call?? m sure there better way it.

thanks

     def test      em.run {       http = eventmachine::httprequest.new("http://localhost:5000/foo/bar")               .post({                     :body =>  params.to_json,                   :head => {                'content-type' => 'application/json; charset=utf-8'                    }                })         http.callback {
           p http.response_header.status
               p  http.response_header
             p http.response
           p http.last_effective_url 
          eventmachine.stop
        }
}      end  
=> :test irb(main):247:0> test  302 {"connection"=>"close", "date"=>"thu, xx nov xxxx 11:39:48 gmt","location"=>"http://localhost:5000/foo/bar/ce3bfc7fb07c076480bb398a802e4a83f7e686b"} "" #<addressable::uri:0x3fd469e275fc uri:http://localhost:5000/foo/bar> => nil 


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -