Sha256: 1875ed0c4d6c3db40fb90d6cc0d972472ee0404585f41d18e90dc8d76e35ce30

Contents?: true

Size: 650 Bytes

Versions: 12

Compression:

Stored size: 650 Bytes

Contents

module VCR
  module Normalizers
    module Body
      def initialize(*args)
        super
        normalize_body
      end

      private

      def normalize_body
        # Ensure that the body is a raw string, in case the string instance
        # has been subclassed or extended with additional instance variables
        # or attributes, so that it is serialized to YAML as a raw string.
        # This is needed for rest-client.  See this ticket for more info:
        # http://github.com/myronmarston/vcr/issues/4
        self.body = case body
          when nil, ''; nil
          else String.new(body)
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
vcr-1.11.3 lib/vcr/structs/normalizers/body.rb
vcr-1.11.2 lib/vcr/structs/normalizers/body.rb
vcr-1.11.1 lib/vcr/structs/normalizers/body.rb
vcr-1.10.3 lib/vcr/structs/normalizers/body.rb
vcr-1.10.2 lib/vcr/structs/normalizers/body.rb
vcr-1.10.0 lib/vcr/structs/normalizers/body.rb
vcr-1.9.0 lib/vcr/structs/normalizers/body.rb
vcr-1.8.0 lib/vcr/structs/normalizers/body.rb
vcr-1.7.2 lib/vcr/structs/normalizers/body.rb
vcr-1.7.1 lib/vcr/structs/normalizers/body.rb
vcr-1.7.0 lib/vcr/structs/normalizers/body.rb
vcr-1.6.0 lib/vcr/structs/normalizers/body.rb