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.79.1 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.79.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.78.1 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.78.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.77.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.76.2 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.76.1 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.76.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.75.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.74.1 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.74.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.73.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.72.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.71.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.70.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.69.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.68.1 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.68.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.67.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb
pact_broker-2.66.0 lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb