Class: PactBroker::Webhooks::HttpResponseWithUtf8SafeBody

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb

Instance Method Summary collapse

Instance Method Details

#bodyObject



4
5
6
7
8
9
10
# File 'lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb', line 4

def body
  if unsafe_body
    unsafe_body.encode("UTF-8", "binary", invalid: :replace, undef: :replace, replace: "")
  else
    unsafe_body
  end
end

#unsafe_bodyObject



12
13
14
# File 'lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb', line 12

def unsafe_body
  __getobj__().body
end

#unsafe_body?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/pact_broker/webhooks/http_response_with_utf_8_safe_body.rb', line 16

def unsafe_body?
  unsafe_body != body
end