File tree 1 file changed +15
-1
lines changed
lib/pact/consumer_contract
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,13 @@ def prepare_request(uri, options)
108
108
http . use_ssl = ( uri . scheme == 'https' )
109
109
http . ca_file = ENV [ 'SSL_CERT_FILE' ] if ENV [ 'SSL_CERT_FILE' ] && ENV [ 'SSL_CERT_FILE' ] != ''
110
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 ]
111
+ http . set_debug_output ( Pact ::Http ::AuthorizationHeaderRedactor . new ( Pact . configuration . output_stream ) ) if verbose? ( options )
112
+ if disable_ssl_verification?
113
+ if verbose? ( options )
114
+ Pact . configuration . output_stream . puts ( "SSL verification is disabled" )
115
+ end
116
+ http . verify_mode = OpenSSL ::SSL ::VERIFY_NONE
117
+ end
112
118
http
113
119
end
114
120
@@ -139,5 +145,13 @@ def delay_retry(count)
139
145
def windows_safe ( uri )
140
146
uri . start_with? ( "http" ) ? uri : uri . gsub ( "\\ " , File ::SEPARATOR )
141
147
end
148
+
149
+ def verbose? ( options )
150
+ options [ :verbose ] || ENV [ 'VERBOSE' ] == 'true'
151
+ end
152
+
153
+ def disable_ssl_verification?
154
+ ENV [ 'PACT_DISABLE_SSL_VERIFICATION' ] == 'true' || ENV [ 'PACT_BROKER_DISABLE_SSL_VERIFICATION' ] == 'true'
155
+ end
142
156
end
143
157
end
You can’t perform that action at this time.
0 commit comments