Skip to content
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

feat(binding/json): check validity when bind json #3982

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

demoManito
Copy link
Contributor

@demoManito demoManito commented May 29, 2024

Description

The current situation is that an incorrect JSON format returns unexpected EOF. This usually happens when the JSON data is not fully received or the parser reaches an unexpected end of file. This error message may not be clear enough for users to understand where the issue lies.

After this PR modification, it will return a more explicit error message invalid JSON, indicating that the received JSON data cannot be correctly parsed into a valid JSON structure, thus providing a clearer indication of formatting issues.

@demoManito demoManito force-pushed the json-valid branch 3 times, most recently from b3cb5ce to 1aa47c8 Compare May 29, 2024 11:41
@demoManito demoManito changed the title feat(binding/json): check validity when Bind json feat(binding/json): check validity when bind json May 29, 2024
Copy link

codecov bot commented May 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.06%. Comparing base (3dc1cd6) to head (563f4f6).
Report is 62 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3982      +/-   ##
==========================================
- Coverage   99.21%   99.06%   -0.15%     
==========================================
  Files          42       44       +2     
  Lines        3182     2779     -403     
==========================================
- Hits         3157     2753     -404     
+ Misses         17       15       -2     
- Partials        8       11       +3     
Flag Coverage Δ
?
-tags "sonic avx" 99.05% <100.00%> (?)
-tags go_json 99.05% <100.00%> (?)
-tags nomsgpack 99.04% <100.00%> (?)
go-1.18 ?
go-1.19 ?
go-1.20 ?
go-1.21 99.06% <100.00%> (-0.15%) ⬇️
go-1.22 99.06% <100.00%> (?)
macos-latest 99.06% <100.00%> (-0.15%) ⬇️
ubuntu-latest 99.06% <100.00%> (-0.15%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@demoManito demoManito force-pushed the json-valid branch 2 times, most recently from 8290262 to 1367e07 Compare May 30, 2024 05:32
@RedCrazyGhost
Copy link
Contributor

json This part of the module is not suitable for use unexpected EOF

Such a function may still need further thinking and discussion.

@demoManito
Copy link
Contributor Author

The current situation is that an incorrect JSON format returns unexpected EOF. After this PR, it will return the error invalid json

Hello, my previous description might not have been very clear.

The current situation is that an incorrect JSON format returns unexpected EOF. After this PR modification, it will return the error invalid json.

@demoManito
Copy link
Contributor Author

@appleboy PTAL

Signed-off-by: demoManito <1430482733@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants