Sha256: 5d78cd4cc33d2980be1e8b380ae57062004f70b997a8998a5ef435aa080acab5

Contents?: true

Size: 424 Bytes

Versions: 65

Compression:

Stored size: 424 Bytes

Contents

module PactBroker
  module Webhooks
    class HttpResponseWithUtf8SafeBody < SimpleDelegator
      def body
        if unsafe_body
          unsafe_body.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '')
        else
          unsafe_body
        end
      end

      def unsafe_body
        __getobj__().body
      end

      def unsafe_body?
        unsafe_body != body
      end
    end
  end
end

Version data entries

65 entries across 65 versions & 1 rubygems

Version Path
pact_broker-2.36.1 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.36.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.35.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.34.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.33.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb