class ALGOSEC_SDK::AdvancedJSONClient

Adds the ability for httpclient to set proper content-type for Hash AND Array body

Public Instance Methods

argument_to_hash_for_json(args) click to toggle source
# File lib/algosec-sdk/rest.rb, line 12
def argument_to_hash_for_json(args)
  hash = argument_to_hash(args, :body, :header, :follow_redirect)
  if hash[:body].is_a?(Hash) || hash[:body].is_a?(Array)
    hash[:header] = json_header(hash[:header])
    hash[:body] = JSON.generate(hash[:body])
  end
  hash
end