Merge pull request #7140 from jimi-c/issue_6962_traceback_callbacks_unicode
Fix handling of non-JSON lines in responses
This commit is contained in:
commit
460794d697
1 changed files with 2 additions and 1 deletions
|
@ -884,10 +884,11 @@ def filter_leading_non_json_lines(buf):
|
|||
filter only leading lines since multiline JSON is valid.
|
||||
'''
|
||||
|
||||
kv_regex = re.compile(r'.*\w+=\w+.*')
|
||||
filtered_lines = StringIO.StringIO()
|
||||
stop_filtering = False
|
||||
for line in buf.splitlines():
|
||||
if stop_filtering or "=" in line or line.startswith('{') or line.startswith('['):
|
||||
if stop_filtering or kv_regex.match(line) or line.startswith('{') or line.startswith('['):
|
||||
stop_filtering = True
|
||||
filtered_lines.write(line + '\n')
|
||||
return filtered_lines.getvalue()
|
||||
|
|
Loading…
Reference in a new issue