Module: RasaCore::ResponseFormatter

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

Instance Method Summary collapse

Instance Method Details

#format_response_body(body, frmt) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/rasa_core/response_formatter.rb', line 3

def format_response_body(body, frmt)
  if [:no_format, :json].include?(frmt)
    body
  else
    JSON.parse(body || '{}', object_class: OpenStruct)
  end
end