-
-
Notifications
You must be signed in to change notification settings - Fork 290
fix: json decode bug #955
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
base: main
Are you sure you want to change the base?
fix: json decode bug #955
Conversation
# Conflicts: # integration_tests/base_routes.py
@asamaayako is attempting to deploy a commit to the sparckles Team on Vercel. A member of the Team first needs to authorize it. |
CodSpeed Performance ReportMerging #955 will not alter performanceComparing Summary
|
Hey @asamaayako 👋 Could you explain the confilct you are facing? I will be happy to help :D |
Hey @sansyrox Previously encountered a conflict, merge conflict (failed to pass test after merging the main branch into this branch). I think at the time the main branch had code that couldn't pass test. So I force push rolled back the merge. |
Hey @VishnuSanal , Could you review this PR? |
@asamaayako , |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
07f28de
to
0b766c9
Compare
"route, body, expected_result", | ||
[ | ||
("/sync/request_json/json_type", '{"start": null}', {"start": None}), # null | ||
("/sync/request_json/json_type", '{"hello": "world"', None), # invalid json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potential JSON decoding error: The test case tests invalid JSON input but uses json.loads(res.text) unconditionally in the assertion. This will raise a JSONDecodeError when trying to parse the invalid JSON response, causing the test to fail with an exception rather than reaching the assertion. The test should handle the JSON parsing error gracefully or verify the raw response for invalid JSON cases.
React with 👍 to tell me that this comment was useful, or 👎 if not (and I'll stop posting more comments like this in the future)
) | ||
def test_request_type(route, body, expected_result): | ||
res = post(route, body) | ||
res_dict = json.loads(res.text) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing error handling: The code unconditionally attempts to parse the response as JSON without any try-except block. This will cause unhandled JSONDecodeError exceptions for invalid JSON responses (like in the test case on line 25), instead of allowing the test to properly verify the error condition.
React with 👍 to tell me that this comment was useful, or 👎 if not (and I'll stop posting more comments like this in the future)
😱 Found 2 issues. Time to roll up your sleeves! 😱 |
Description
This PR fixes #816 , and it a retry PR.
Summary
This PR is try again. I'm having a conflict, and retrying met a can't pass banchmark😥. Maybe I need help to Pass test.
Define a function for processing json_string to PyObject
PR Checklist
Please ensure that:
Pre-Commit Instructions: