-
Notifications
You must be signed in to change notification settings - Fork 1.7k
1059-Fixing a bug with multiple json objects #1081
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I was also running into issue #1059. This fixes it for me but does not seem like a good solution. I was also unable to update the unit tests to show the bug. For some reason it works fine in testing. Here is the test I was using:
|
Any update on this being merged? The build looks green (although Janky hasn't updated correctly). |
It's difficult to integration test because the API streaming endpoint won't necessarily always concatenate multiple JSON objects in one chunk. It's even difficult to unit test in its current state, because If you can decouple the inner logic so it just operates on an IO object, then you should be able to write a unit test that passes in a mock object which emits a chunk of multiple JSON objects when read from. |
This splits the text by CRLF and then json.loads each part independently instead of attempting the parse the whole string. Signed-off-by: Tristan Escalada <tristan@escalada.us>
I have the same problem and I think we must split chunks before decode. Otherwise, we will have the problem with the glued raw data. Now, I use similar patch in my code (Python 3.x only):
|
Any updates on this? I recently ran into this issue. |
This PR fixes the issue for me. Can it be merged soon? |
Thank you! |
This splits the text by CRLF and then json.loads each part
independently instead of attempting the parse the whole string.
Signed-off-by: Tristan Escalada tristan@escalada.us