pact 1.40.0 → 1.41.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/pact/hal/authorization_header_redactor.rb +32 -0
- data/lib/pact/hal/http_client.rb +6 -1
- data/lib/pact/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96a4c13319a6a73992c90671ac2bd8534c5cc8b7
|
4
|
+
data.tar.gz: 635cd37e9d7dfb4e0e96df05ed6f04fe5950d715
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7e439fab1aa8e5ac7213bdd07b3253477c15c5f134bb85587569e20aaf78b474121b1979ec97deb699af37e510a9a140b5cceb2a7ab83aa841ad861792ee8e4
|
7
|
+
data.tar.gz: 2fe5aff283d9aa665ae86612d37cf39e1472b9c38120d8d5caf6ce1239e57b29e899576c7cbc9c48d38a511266c3e926c5589b9b5999b43f69effb1ace20ef29
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'delegate'
|
2
|
+
|
3
|
+
module Pact
|
4
|
+
module Hal
|
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/hal/http_client.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'pact/retry'
|
2
|
+
require 'pact/hal/authorization_header_redactor'
|
2
3
|
require 'net/http'
|
3
4
|
|
4
5
|
module Pact
|
@@ -47,7 +48,7 @@ module Pact
|
|
47
48
|
def perform_request request, uri
|
48
49
|
response = Retry.until_true do
|
49
50
|
http = Net::HTTP.new(uri.host, uri.port, :ENV)
|
50
|
-
http.set_debug_output(
|
51
|
+
http.set_debug_output(output_stream) if verbose
|
51
52
|
http.use_ssl = (uri.scheme == 'https')
|
52
53
|
http.start do |http|
|
53
54
|
http.request request
|
@@ -56,6 +57,10 @@ module Pact
|
|
56
57
|
Response.new(response)
|
57
58
|
end
|
58
59
|
|
60
|
+
def output_stream
|
61
|
+
AuthorizationHeaderRedactor.new(Pact.configuration.output_stream)
|
62
|
+
end
|
63
|
+
|
59
64
|
class Response < SimpleDelegator
|
60
65
|
def body
|
61
66
|
bod = raw_body
|
data/lib/pact/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pact
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.41.0
|
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: 2019-
|
15
|
+
date: 2019-05-22 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: randexp
|
@@ -318,6 +318,7 @@ files:
|
|
318
318
|
- lib/pact/doc/markdown/interaction.erb
|
319
319
|
- lib/pact/doc/markdown/interaction_renderer.rb
|
320
320
|
- lib/pact/doc/sort_interactions.rb
|
321
|
+
- lib/pact/hal/authorization_header_redactor.rb
|
321
322
|
- lib/pact/hal/entity.rb
|
322
323
|
- lib/pact/hal/http_client.rb
|
323
324
|
- lib/pact/hal/link.rb
|