Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix!: Throw error on invalid JSON in response#984

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
jbelkins wants to merge4 commits intomain
base:main
Choose a base branch
Loading
fromjbe/invalid_json_fix

Conversation

@jbelkins
Copy link
Contributor

@jbelkinsjbelkins commentedOct 22, 2025
edited
Loading

Description of changes

Currently, when a response contains invalid JSON, the error is caught & not rethrown, and the response body is treated as an empty JSON object{}.

This can lead to misleading responses, i.e. leading the caller to believe that the request succeeded but returned no results versus that it was not parseable.

  • Theguard that handles the empty-response case now has some commentary to explain why it's there.
  • Our JSON parser was set to allow fragments. This is not needed for SDK use and is removed. (A couple tests had to have their setup altered to accommodate this, since they were using fragments for simplicity of setup.)
  • We were catching theNSError that is thrown when JSON is invalid, and converting it to a successful response. That catch is now removed.
  • Empty bodies are explicitly allowed by JSON-based AWS protocols, and are generally to be treated as an empty JSON object{}. That behavior is unchanged.

To be determined: figure out exactly what error should be thrown back to the caller, create it and throw it.

This is a breaking change in that it alters the SDK's behavior from "empty success" to throwing when unparseable data is encountered in a response.

Scope

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

lettraceInterceptor=TraceInterceptor<TestInput,TestOutput,HTTPRequest,HTTPResponse>(trace: trace)
letbuilder=OrchestratorBuilder<TestInput,TestOutput,HTTPRequest,HTTPResponse>()
.attributes(attributes)
.serialize({ input, builder, _in
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The tests below used JSON fragments (i.e. a JSON string only) for serde since fragments were allowed and it kept the test setup simpler. Tests now serialize JSON objects.

@jbelkinsjbelkins changed the titlefix: Throw error on invalid JSON in responsefix!: Throw error on invalid JSON in responseOct 24, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@jbelkins

[8]ページ先頭

©2009-2025 Movatter.jp