Skip to content

Commit 1103f94

Browse files
committed
Not injecting live script when serving non-HTML content - fix #277
1 parent 62d016a commit 1103f94

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

livereload/server.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ def __init__(self, request):
102102
super().__init__(request)
103103

104104
def transform_first_chunk(self, status_code, headers, chunk, finishing):
105-
if HEAD_END in chunk:
105+
is_html = "html" in headers.get("Content-Type", "")
106+
if is_html and HEAD_END in chunk:
106107
chunk = chunk.replace(HEAD_END, self.script + HEAD_END, 1)
107108
if 'Content-Length' in headers:
108109
length = int(headers['Content-Length']) + len(self.script)

0 commit comments

Comments
 (0)