Sha256: f4c7b960200f2a5587fdc749d276d351f69e102aace12d02a225c7bd887146cf

Contents?: true

Size: 890 Bytes

Versions: 38

Compression:

Stored size: 890 Bytes

Contents

module Aws
  module Json

    # This plugin performs two trivial translations:
    #
    # * The request parameters are serialized as JSON for the request body
    # * The response body is deserialized as JSON for the response data
    #
    # No attempt is made to extract errors from the HTTP response body.
    # Parsing the response only happens for a successful response.
    #
    class SimpleBodyHandler < Seahorse::Client::Handler

      def call(context)
        build_json(context)
        @handler.call(context).on_success do |response|
          response.error = nil
          response.data = parse_json(context)
        end
      end

      private

      def build_json(context)
        context.http_request.body = MultiJson.dump(context.params)
      end

      def parse_json(context)
        MultiJson.load(context.http_response.body_contents)
      end

    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
aws-sdk-core-2.0.48 lib/aws-sdk-core/json/simple_body_handler.rb
aws-sdk-core-2.0.47 lib/aws-sdk-core/json/simple_body_handler.rb
aws-sdk-core-2.0.46 lib/aws-sdk-core/json/simple_body_handler.rb
aws-sdk-core-2.0.45 lib/aws-sdk-core/json/simple_body_handler.rb
aws-sdk-core-2.0.44 lib/aws-sdk-core/json/simple_body_handler.rb
aws-sdk-core-2.0.43 lib/aws-sdk-core/json/simple_body_handler.rb
aws-sdk-core-2.0.42 lib/aws-sdk-core/json/simple_body_handler.rb
aws-sdk-core-2.0.41 lib/aws-sdk-core/json/simple_body_handler.rb
aws-sdk-core-2.0.40 lib/aws-sdk-core/json/simple_body_handler.rb
aws-sdk-core-2.0.39 lib/aws-sdk-core/json/simple_body_handler.rb
aws-sdk-core-2.0.38 lib/aws-sdk-core/json/simple_body_handler.rb
aws-sdk-core-2.0.37 lib/aws-sdk-core/json/simple_body_handler.rb
aws-sdk-core-2.0.36 lib/aws-sdk-core/json/simple_body_handler.rb
aws-sdk-core-2.0.35 lib/aws-sdk-core/json/simple_body_handler.rb
aws-sdk-core-2.0.34 lib/aws-sdk-core/json/simple_body_handler.rb
aws-sdk-core-2.0.33 lib/aws-sdk-core/json/simple_body_handler.rb
aws-sdk-core-2.0.32 lib/aws-sdk-core/json/simple_body_handler.rb
aws-sdk-core-2.0.31 lib/aws-sdk-core/json/simple_body_handler.rb
aws-sdk-core-2.0.30 lib/aws-sdk-core/json/simple_body_handler.rb
aws-sdk-core-2.0.29 lib/aws-sdk-core/json/simple_body_handler.rb