pact-support 1.16.7 → 1.16.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/pact/consumer_contract/pact_file.rb +7 -4
- data/lib/pact/http/authorization_header_redactor.rb +32 -0
- data/lib/pact/support/version.rb +1 -1
- metadata +6 -5
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 03a46a4e6bb3335f9acc353c80f485bd22d92e6b137e85fd25559a141eb282da
         | 
| 4 | 
            +
              data.tar.gz: 967af721b125b04d725e5743a6759c6215b3b2af5e99526b9bbcfdf019ae0f05
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: ee9efbb1051d9064ffe0079711885e56b90c14e01868d8afbb5a9b08bd85ca42f89226f805a61c44f6d565ba61157250b36dbc742722bb859af2789de21b0292
         | 
| 7 | 
            +
              data.tar.gz: bff0e437c5392f0ead03eba3d0932ac71eea1a1fd44f6add3f68a3df023092bca101a465fc16c13f633efb9f1eb19c336705161d67aaac9dfff116b191fe5546
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    
| @@ -1,4 +1,6 @@ | |
| 1 | 
            -
            require  | 
| 1 | 
            +
            require "net/http"
         | 
| 2 | 
            +
            require "pact/configuration"
         | 
| 3 | 
            +
            require "pact/http/authorization_header_redactor"
         | 
| 2 4 |  | 
| 3 5 | 
             
            module Pact
         | 
| 4 6 | 
             
              module PactFile
         | 
| @@ -81,7 +83,7 @@ module Pact | |
| 81 83 | 
             
                  request = Net::HTTP::Get.new(uri)
         | 
| 82 84 | 
             
                  request = prepare_auth(request, options) if options[:username] || options[:token]
         | 
| 83 85 |  | 
| 84 | 
            -
                  http = prepare_request(uri)
         | 
| 86 | 
            +
                  http = prepare_request(uri, options)
         | 
| 85 87 | 
             
                  response = perform_http_request(http, request, options)
         | 
| 86 88 |  | 
| 87 89 | 
             
                  if response.is_a?(Net::HTTPRedirection)
         | 
| @@ -89,7 +91,7 @@ module Pact | |
| 89 91 | 
             
                    req = Net::HTTP::Get.new(uri)
         | 
| 90 92 | 
             
                    req = prepare_auth(req, options) if options[:username] || options[:token]
         | 
| 91 93 |  | 
| 92 | 
            -
                    http = prepare_request(uri)
         | 
| 94 | 
            +
                    http = prepare_request(uri, options)
         | 
| 93 95 | 
             
                    response = perform_http_request(http, req, options)
         | 
| 94 96 | 
             
                  end
         | 
| 95 97 | 
             
                  response
         | 
| @@ -101,11 +103,12 @@ module Pact | |
| 101 103 | 
             
                  request
         | 
| 102 104 | 
             
                end
         | 
| 103 105 |  | 
| 104 | 
            -
                def prepare_request(uri)
         | 
| 106 | 
            +
                def prepare_request(uri, options)
         | 
| 105 107 | 
             
                  http = Net::HTTP.new(uri.host, uri.port, :ENV)
         | 
| 106 108 | 
             
                  http.use_ssl = (uri.scheme == 'https')
         | 
| 107 109 | 
             
                  http.ca_file = ENV['SSL_CERT_FILE'] if ENV['SSL_CERT_FILE'] && ENV['SSL_CERT_FILE'] != ''
         | 
| 108 110 | 
             
                  http.ca_path = ENV['SSL_CERT_DIR'] if ENV['SSL_CERT_DIR'] && ENV['SSL_CERT_DIR'] != ''
         | 
| 111 | 
            +
                  http.set_debug_output(Pact::Http::AuthorizationHeaderRedactor.new(Pact.configuration.output_stream)) if options[:verbose]
         | 
| 109 112 | 
             
                  http
         | 
| 110 113 | 
             
                end
         | 
| 111 114 |  | 
| @@ -0,0 +1,32 @@ | |
| 1 | 
            +
            require "delegate"
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Pact
         | 
| 4 | 
            +
              module Http
         | 
| 5 | 
            +
                class AuthorizationHeaderRedactor < SimpleDelegator
         | 
| 6 | 
            +
                  def puts(*args)
         | 
| 7 | 
            +
                    __getobj__().puts(*redact_args(args))
         | 
| 8 | 
            +
                  end
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                  def print(*args)
         | 
| 11 | 
            +
                    __getobj__().puts(*redact_args(args))
         | 
| 12 | 
            +
                  end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                  def <<(*args)
         | 
| 15 | 
            +
                    __getobj__().send(:<<, *redact_args(args))
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                  private
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                  attr_reader :redactions
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                  def redact_args(args)
         | 
| 23 | 
            +
                    args.collect{ | s| redact(s) }
         | 
| 24 | 
            +
                  end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                  def redact(string)
         | 
| 27 | 
            +
                    return string unless string.is_a?(String)
         | 
| 28 | 
            +
                    string.gsub(/Authorization: .*\\r\\n/, "Authorization: [redacted]\\r\\n")
         | 
| 29 | 
            +
                  end
         | 
| 30 | 
            +
                end
         | 
| 31 | 
            +
              end
         | 
| 32 | 
            +
            end
         | 
    
        data/lib/pact/support/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: pact-support
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.16. | 
| 4 | 
            +
              version: 1.16.8
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - James Fraser
         | 
| @@ -12,7 +12,7 @@ authors: | |
| 12 12 | 
             
            autorequire: 
         | 
| 13 13 | 
             
            bindir: bin
         | 
| 14 14 | 
             
            cert_chain: []
         | 
| 15 | 
            -
            date: 2021- | 
| 15 | 
            +
            date: 2021-07-27 00:00:00.000000000 Z
         | 
| 16 16 | 
             
            dependencies:
         | 
| 17 17 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 18 18 | 
             
              name: randexp
         | 
| @@ -48,14 +48,14 @@ dependencies: | |
| 48 48 | 
             
                requirements:
         | 
| 49 49 | 
             
                - - "~>"
         | 
| 50 50 | 
             
                  - !ruby/object:Gem::Version
         | 
| 51 | 
            -
                    version: '1. | 
| 51 | 
            +
                    version: '1.9'
         | 
| 52 52 | 
             
              type: :runtime
         | 
| 53 53 | 
             
              prerelease: false
         | 
| 54 54 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 55 55 | 
             
                requirements:
         | 
| 56 56 | 
             
                - - "~>"
         | 
| 57 57 | 
             
                  - !ruby/object:Gem::Version
         | 
| 58 | 
            -
                    version: '1. | 
| 58 | 
            +
                    version: '1.9'
         | 
| 59 59 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 60 60 | 
             
              name: diff-lcs
         | 
| 61 61 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -254,6 +254,7 @@ files: | |
| 254 254 | 
             
            - lib/pact/consumer_contract/string_with_matching_rules.rb
         | 
| 255 255 | 
             
            - lib/pact/errors.rb
         | 
| 256 256 | 
             
            - lib/pact/helpers.rb
         | 
| 257 | 
            +
            - lib/pact/http/authorization_header_redactor.rb
         | 
| 257 258 | 
             
            - lib/pact/logging.rb
         | 
| 258 259 | 
             
            - lib/pact/matchers.rb
         | 
| 259 260 | 
             
            - lib/pact/matchers/actual_type.rb
         | 
| @@ -318,7 +319,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 318 319 | 
             
                - !ruby/object:Gem::Version
         | 
| 319 320 | 
             
                  version: '0'
         | 
| 320 321 | 
             
            requirements: []
         | 
| 321 | 
            -
            rubygems_version: 3.2. | 
| 322 | 
            +
            rubygems_version: 3.2.24
         | 
| 322 323 | 
             
            signing_key: 
         | 
| 323 324 | 
             
            specification_version: 4
         | 
| 324 325 | 
             
            summary: Shared code for Pact gems
         |