8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/rsolr/synchrony_connection.rb', line 8
def execute client, request_context
method = request_context[:method]
options = {}
options[:head] = request_context[:headers] || {}
options[:body] = request_context[:data] if request_context[:body].to_s
options[:proxy] ||= request_context[:proxy] if request_context[:proxy]
if request_context[:uri].user && request_context[:uri].password
options[:head]['authorization'] = [ request_context[:uri].user, request_context[:uri].password ]
request_context[:uri].user = nil
request_context[:uri].password = nil
end
http_request = EventMachine::HttpRequest.new(request_context[:uri].to_s)
response = http_request.send(method, options)
{ status: response..status, headers: response., body: response.response }
end
|