我用以下代码来管理吉大港山区的申请,但第二项请求(req2)总是回退。
我在这里没有明显的东西?
request_options = {
:body => " ",
:keepalive => true,
:head => {
content-type => application/json ,
accept => application/json ,
Accept-Encoding => gzip,deflate,sdch
}
}
EM.run do
request_options[:path] = /default/path
conn = EM::HttpRequest.new https://www.example.com
req1 = conn.post request_options
req1.errback { p Uh, oh ; EM.stop }
req1.callback do
doc = JSON.parse req1.response
# do stuff with doc
request_options[:body] = post-data
request_options[:path] = /new/path
req2 = conn.post request_options
req2.errback { p Uh, oh ; EM.stop }
req2.callback do
puts req2.response
EM.stop
end
end
end