Skip to content

Commit 669a046

Browse files
committed
Make user_agent optional everywhere end also handle an explicit nil in ContentSecurityPolicy
1 parent 4fb9662 commit 669a046

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

lib/secure_headers/headers/content_security_policy.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class ContentSecurityPolicy
1313
FALLBACK_VERSION = ::UserAgent::Version.new("0")
1414

1515
def initialize(config = nil, user_agent = OTHER)
16+
user_agent ||= OTHER
1617
@config = if config.is_a?(Hash)
1718
if config[:report_only]
1819
ContentSecurityPolicyReportOnlyConfig.new(config || DEFAULT_CONFIG)

lib/secure_headers/headers/policy_management.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ module ClassMethods
200200
#
201201
# Returns a default policy if no configuration is provided, or a
202202
# header name and value based on the config.
203-
def make_header(config, user_agent)
203+
def make_header(config, user_agent = nil)
204204
return if config.nil? || config == OPT_OUT
205205
header = new(config, user_agent)
206206
[header.name, header.value]

0 commit comments

Comments
 (0)