mirror of
https://github.com/jnunemaker/httparty
synced 2023-03-27 23:23:07 -04:00
Adds class method for setting PKCS12 certificate
This commit is contained in:
parent
a1b52f231d
commit
8afab49443
2 changed files with 23 additions and 0 deletions
|
@ -282,6 +282,17 @@ module HTTParty
|
|||
default_options[:pem_password] = password
|
||||
end
|
||||
|
||||
# Allows setting a PKCS12 file to be used
|
||||
#
|
||||
# class Foo
|
||||
# include HTTParty
|
||||
# pkcs12 File.read('/home/user/my.p12'), "password"
|
||||
# end
|
||||
def pkcs12(p12_contents, password)
|
||||
default_options[:p12] = p12_contents
|
||||
default_options[:p12_password] = password
|
||||
end
|
||||
|
||||
# Override the way query strings are normalized.
|
||||
# Helpful for overriding the default rails normalization of Array queries.
|
||||
#
|
||||
|
|
|
@ -38,6 +38,18 @@ describe HTTParty do
|
|||
end
|
||||
end
|
||||
|
||||
describe "pkcs12" do
|
||||
it 'should set the p12 content' do
|
||||
@klass.pkcs12 'P12-CONTENT', 'PASSWORD'
|
||||
@klass.default_options[:p12].should == 'P12-CONTENT'
|
||||
end
|
||||
|
||||
it 'should set the password' do
|
||||
@klass.pkcs12 'P12-CONTENT', 'PASSWORD'
|
||||
@klass.default_options[:p12_password].should == 'PASSWORD'
|
||||
end
|
||||
end
|
||||
|
||||
describe 'ssl_version' do
|
||||
it 'should set the ssl_version content' do
|
||||
@klass.ssl_version :SSLv3
|
||||
|
|
Loading…
Add table
Reference in a new issue