Module: RasaCore::TyphoeusClient

Included in:
Client
Defined in:
lib/rasa_core/typhoeus_client.rb

Instance Method Summary collapse

Instance Method Details

#run_request(args = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/rasa_core/typhoeus_client.rb', line 3

def run_request(args={})
  headers = {'Content-Type': 'application/json'}.merge(args[:headers] || {})
  request = Typhoeus::Request.new(args[:url],
    method: args[:method] || 'get',
    body: args[:body].to_json,
    headers: headers)

    request.run
    request.response
end