File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -178,16 +178,28 @@ def expect_default_values(hash)
178178 it "produces a hash with a mix of config values, override values, and default values" do
179179 ::SecureHeaders ::Configuration . configure do |config |
180180 config . hsts = { :max_age => '123456' }
181+ config . hpkp = {
182+ :enforce => true ,
183+ :max_age => 1000000 ,
184+ :include_subdomains => true ,
185+ :report_uri => '//example.com/uri-directive' ,
186+ :pins => [
187+ { :sha256 => 'abc' } ,
188+ { :sha256 => '123' }
189+ ]
190+ }
181191 end
182192
183193 hash = SecureHeaders ::header_hash ( :csp => { :default_src => 'none' , :img_src => "data:" , :disable_fill_missing => true } )
184194 ::SecureHeaders ::Configuration . configure do |config |
185195 config . hsts = nil
196+ config . hpkp = nil
186197 end
187198
188199 expect ( hash [ 'Content-Security-Policy-Report-Only' ] ) . to eq ( "default-src 'none'; img-src data:;" )
189200 expect ( hash [ XFO_HEADER_NAME ] ) . to eq ( SecureHeaders ::XFrameOptions ::Constants ::DEFAULT_VALUE )
190201 expect ( hash [ HSTS_HEADER_NAME ] ) . to eq ( "max-age=123456" )
202+ expect ( hash [ HPKP_HEADER_NAME ] ) . to eq ( %{max-age=1000000; pin-sha256="abc"; pin-sha256="123"; report-uri="//example.com/uri-directive"; includeSubDomains} )
191203 end
192204
193205 it "produces a hash of headers with default config" do
You can’t perform that action at this time.
0 commit comments