class Aws::Json::RpcBodyHandler

Public Instance Methods

call(context) click to toggle source

@param [Seahorse::Client::RequestContext] context @return [Seahorse::Client::Response]

# File lib/aws-sdk-core/json/rpc_body_handler.rb, line 7
def call(context)
  build_json(context)
  @handler.call(context).on_success do |response|
    unless response.error
      response.data = parse_json(context)
    end
  end
end

Private Instance Methods

build_json(context) click to toggle source
# File lib/aws-sdk-core/json/rpc_body_handler.rb, line 18
def build_json(context)
  if shape = context.operation.input
    context.http_request.body = Builder.new.to_json(shape, context.params)
  else
    context.http_request.body = '{}'
  end
end
parse_json(context) click to toggle source
# File lib/aws-sdk-core/json/rpc_body_handler.rb, line 26
def parse_json(context)
  if output_shape = context.operation.output
    json = context.http_response.body_contents
    json = '{}' if json == ''
    Parser.new.parse(output_shape, json)
  else
    EmptyStructure.new
  end
end