Sha256: 20215c15a6c04899aca7d754e30e7243b0c45a924f30c086c49301674ab4aa92

Contents?: true

Size: 1007 Bytes

Versions: 8

Compression:

Stored size: 1007 Bytes

Contents

# frozen_string_literal: true

module Aws
  module Stubbing
    module Protocols
      # @api private
      class RpcV2

        def stub_data(_api, operation, data)
          resp = Seahorse::Client::Http::Response.new
          resp.status_code = 200
          resp.headers['Smithy-Protocol'] = 'rpc-v2-cbor'
          resp.headers['Content-Type'] = 'application/cbor'
          resp.headers['x-amzn-RequestId'] = 'stubbed-request-id'
          resp.body = build_body(operation, data)
          resp
        end

        def stub_error(error_code)
          resp = Seahorse::Client::Http::Response.new
          resp.status_code = 400
          resp.body = Aws::RpcV2.encode(
            {
              'code' => error_code,
              'message' => 'stubbed-response-error-message'
            }
          )
          resp
        end

        private

        def build_body(operation, data)
          Aws::RpcV2::Builder.new(operation.output).serialize(data)
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
aws-sdk-core-3.216.0 lib/aws-sdk-core/stubbing/protocols/rpc_v2.rb
aws-sdk-core-3.215.1 lib/aws-sdk-core/stubbing/protocols/rpc_v2.rb
aws-sdk-core-3.215.0 lib/aws-sdk-core/stubbing/protocols/rpc_v2.rb
aws-sdk-core-3.214.1 lib/aws-sdk-core/stubbing/protocols/rpc_v2.rb
aws-sdk-core-3.214.0 lib/aws-sdk-core/stubbing/protocols/rpc_v2.rb
aws-sdk-core-3.213.0 lib/aws-sdk-core/stubbing/protocols/rpc_v2.rb
aws-sdk-core-3.212.0 lib/aws-sdk-core/stubbing/protocols/rpc_v2.rb
aws-sdk-core-3.211.0 lib/aws-sdk-core/stubbing/protocols/rpc_v2.rb