Skip to content

Commit 5a7688b

Browse files
committed
fix not check list length
1 parent 270880c commit 5a7688b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

applications/demo/middlewares.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,7 @@ def process_response(self, request, response):
2121
href = re.search(r'href=[\'"](.+?)[\'"]', link[0]).group(1)
2222
as_value = re.search(r'as=[\'"](.+?)[\'"]', link[0]).group(1)
2323
link_headers.append('<{}>; as={}; rel=preload'.format(href, as_value))
24-
response['Link'] = ','.join(link_headers)
24+
25+
if link_headers:
26+
response['Link'] = ','.join(link_headers)
2527
return response

0 commit comments

Comments
 (0)