Skip to content

Commit e15fb19

Browse files
committed
hash syntax
1 parent 5aaf7a6 commit e15fb19

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

lib/secure_headers/headers/public_key_pins.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def validate_config(config)
5050
elsif config[:max_age].to_s !~ /\A\d+\z/
5151
raise PublicKeyPinsBuildError.new("max-age must be a number.
5252
#{config[:max_age]} was supplied.")
53-
elsif config[:pins] and config[:pins].length < 2
53+
elsif config[:pins] && config[:pins].length < 2
5454
raise PublicKeyPinsBuildError.new("A minimum of 2 pins are required.")
5555
end
5656

spec/lib/secure_headers_spec.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def set_security_headers(subject)
120120
it "does not set the HPKP header if request is over HTTP" do
121121
allow(subject).to receive_message_chain(:request, :ssl?).and_return(false)
122122
should_not_assign_header(HPKP_HEADER_NAME)
123-
subject.set_hpkp_header(max_age: 1234)
123+
subject.set_hpkp_header(:max_age => 1234)
124124
end
125125

126126
it "does not set the CSP header if disabled" do
@@ -208,32 +208,32 @@ def set_security_headers(subject)
208208
describe "#set_public_key_pins" do
209209
it "sets the Public-Key-Pins header" do
210210
should_assign_header(HPKP_HEADER_NAME + "-Report-Only", "max-age=1234")
211-
subject.set_hpkp_header(max_age: 1234)
211+
subject.set_hpkp_header(:max_age => 1234)
212212
end
213213

214214
it "allows you to enforce public key pinning" do
215215
should_assign_header(HPKP_HEADER_NAME, "max-age=1234")
216-
subject.set_hpkp_header(max_age: 1234, enforce: true)
216+
subject.set_hpkp_header(:max_age => 1234, :enforce => true)
217217
end
218218

219219
it "allows you to specific a custom max-age value" do
220220
should_assign_header(HPKP_HEADER_NAME + "-Report-Only", 'max-age=1234')
221-
subject.set_hpkp_header(max_age: 1234)
221+
subject.set_hpkp_header(:max_age => 1234)
222222
end
223223

224224
it "allows you to specify includeSubdomains" do
225225
should_assign_header(HPKP_HEADER_NAME, "max-age=1234; includeSubDomains")
226-
subject.set_hpkp_header(max_age: 1234, include_subdomains: true, enforce: true)
226+
subject.set_hpkp_header(:max_age => 1234, :include_subdomains => true, :enforce => true)
227227
end
228228

229229
it "allows you to specify a report-uri" do
230230
should_assign_header(HPKP_HEADER_NAME, "max-age=1234; report-uri=\"https://foobar.com\"")
231-
subject.set_hpkp_header(max_age: 1234, report_uri: "https://foobar.com", enforce: true)
231+
subject.set_hpkp_header(:max_age => 1234, :report_uri => "https://foobar.com", :enforce => true)
232232
end
233233

234234
it "allows you to specify a report-uri with app_name" do
235235
should_assign_header(HPKP_HEADER_NAME, "max-age=1234; report-uri=\"https://foobar.com?enforce=true&app_name=my_app\"")
236-
subject.set_hpkp_header(max_age: 1234, report_uri: "https://foobar.com", app_name: "my_app", tag_report_uri: true, enforce: true)
236+
subject.set_hpkp_header(:max_age => 1234, :report_uri => "https://foobar.com", :app_name => "my_app", :tag_report_uri => true, :enforce => true)
237237
end
238238
end
239239

0 commit comments

Comments
 (0)