Skip to content

Commit 227704c

Browse files
authored
Merge pull request #2671 from minrk/dont-modify-headers
avoid modifying settings['headers'] in add_default_headers
2 parents 66049ea + f512880 commit 227704c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

notebook/base/handlers.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,18 @@ def content_security_policy(self):
6565
return '; '.join([
6666
"frame-ancestors 'self'",
6767
# Make sure the report-uri is relative to the base_url
68-
"report-uri " + url_path_join(self.base_url, csp_report_uri),
68+
"report-uri " + self.settings.get('csp_report_uri', url_path_join(self.base_url, csp_report_uri)),
6969
])
7070

7171
def set_default_headers(self):
72-
headers = self.settings.get('headers', {})
72+
headers = {}
73+
headers.update(self.settings.get('headers', {}))
7374

7475
if "Content-Security-Policy" not in headers:
7576
headers["Content-Security-Policy"] = self.content_security_policy
76-
77+
7778
# Allow for overriding headers
78-
for header_name,value in headers.items() :
79+
for header_name, value in headers.items():
7980
try:
8081
self.set_header(header_name, value)
8182
except Exception as e:

0 commit comments

Comments
 (0)