Sha256: 973615b90bd38a0482a554962fea91143ceb258dfa67180646192cd2d9ae0ffb

Contents?: true

Size: 688 Bytes

Versions: 14

Compression:

Stored size: 688 Bytes

Contents

# frozen_string_literal: true

module Aws
  module Stubbing
    module Protocols
      class RestJson < Rest

        def body_for(_, _, rules, data)
          if eventstream?(rules)
            encode_eventstream_response(rules, data, Aws::Json::Builder)
          else
            Aws::Json::Builder.new(rules).serialize(data)
          end
        end

        def stub_error(error_code)
          http_resp = Seahorse::Client::Http::Response.new
          http_resp.status_code = 400
          http_resp.body = <<-JSON.strip
{
  "code": #{error_code.inspect},
  "message": "stubbed-response-error-message"
}
          JSON
          http_resp
        end

      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
aws-sdk-core-3.109.1 lib/aws-sdk-core/stubbing/protocols/rest_json.rb
aws-sdk-core-3.109.0 lib/aws-sdk-core/stubbing/protocols/rest_json.rb
aws-sdk-core-3.108.0 lib/aws-sdk-core/stubbing/protocols/rest_json.rb
aws-sdk-core-3.107.0 lib/aws-sdk-core/stubbing/protocols/rest_json.rb
aws-sdk-core-3.105.0 lib/aws-sdk-core/stubbing/protocols/rest_json.rb
aws-sdk-core-3.104.4 lib/aws-sdk-core/stubbing/protocols/rest_json.rb
aws-sdk-core-3.104.3 lib/aws-sdk-core/stubbing/protocols/rest_json.rb
aws-sdk-core-3.104.2 lib/aws-sdk-core/stubbing/protocols/rest_json.rb
aws-sdk-core-3.104.1 lib/aws-sdk-core/stubbing/protocols/rest_json.rb
aws-sdk-core-3.104.0 lib/aws-sdk-core/stubbing/protocols/rest_json.rb
aws-sdk-core-3.103.0 lib/aws-sdk-core/stubbing/protocols/rest_json.rb
aws-sdk-core-3.102.1 lib/aws-sdk-core/stubbing/protocols/rest_json.rb
aws-sdk-core-3.102.0 lib/aws-sdk-core/stubbing/protocols/rest_json.rb
aws-sdk-core-3.101.0 lib/aws-sdk-core/stubbing/protocols/rest_json.rb