Skip to content

Commit 7703672

Browse files
authored
Merge pull request #278 from Lucas-C/issue-277
Not injecting live script when serving non-HTML content - fix #277
2 parents 96fb2e1 + 1103f94 commit 7703672

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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)