Sha256: 0d0b11f4c678944515b8df8ba6bbf953f4dccffb6f7a2a5561cafeb499c5ca8d
Contents?: true
Size: 651 Bytes
Versions: 50
Compression:
Stored size: 651 Bytes
Contents
require 'delegate' module Pact module Hal class AuthorizationHeaderRedactor < SimpleDelegator def puts(*args) __getobj__().puts(*redact_args(args)) end def print(*args) __getobj__().puts(*redact_args(args)) end def <<(*args) __getobj__().send(:<<, *redact_args(args)) end private attr_reader :redactions def redact_args(args) args.collect{ | s| redact(s) } end def redact(string) return string unless string.is_a?(String) string.gsub(/Authorization: .*\\r\\n/, "Authorization: [redacted]\\r\\n") end end end end
Version data entries
50 entries across 50 versions & 1 rubygems