78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
# File 'lib/artifice/excon.rb', line 78
def request_kernel(params)
endpoint = self.class.endpoints[params[:host]] ||
self.class.endpoints[:default]
return super unless endpoint
rack_request = RackRequest.new(endpoint)
params[:headers].each do |, value|
rack_request.(, value)
end if params[:headers]
request = "#{params[:scheme]}://#{params[:host]}:#{params[:port]}"
request << params[:path]
request << query_string(params[:query])
response = rack_request.request(request,
{ :method => params[:method], :input => params[:body] })
response = ::Excon::Response.new(:body => response.body,
:headers => response., :status => response.status)
if params.has_key?(:expects) && ![*params[:expects]].include?(response.status)
raise(::Excon::Errors.status_error(params, response))
end
response
end
|