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.65.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.64.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.63.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.62.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.61.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.60.1 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.60.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.59.2 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.59.1 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.59.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.58.3 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.58.2 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.58.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.57.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.56.1 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.56.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.55.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.54.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.53.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.52.2 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb