Skip to content

fix(serve): honor request content types - #6462

Open
lucasjia-aws wants to merge 1 commit into
aws:masterfrom
lucasjia-aws:fix/5006-schema-builder-content-type
Open

lucasjia-aws wants to merge 1 commit into
aws:masterfrom
lucasjia-aws:fix/5006-schema-builder-content-type

Conversation

@lucasjia-aws

@lucasjia-aws lucasjia-aws commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

DeserializerWrapper currently forces its configured Accept type for both request and response deserialization. As a result, valid JSON or CSV requests can be incorrectly parsed as NPY data.

This change makes input deserializers honor the caller-provided Content-Type while preserving the existing output behavior that uses the configured Accept type when model servers return misleading response headers such as text/html.

Testing

  • Added NumPy input regressions for JSON and CSV payloads.
  • Added output coverage proving that a misleading text/html response still uses the configured NPY deserializer.
  • Ran the affected schema-builder suite: 8 passed.
  • Black, Flake8, security exposure checks, and git diff --check passed.
  • Built the sagemaker-serve wheel and source distribution successfully.

Related change

The companion V2 fix is published on #6463.

Fixes #5006

Pass caller-provided content types to request deserializers so JSON and CSV NumPy payloads are decoded correctly. Keep response deserializers pinned to configured Accept types for model servers that return misleading headers.

Fixes aws#5006

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 AI code review

This PR fixes DeserializerWrapper so that input deserializers honor the caller-provided Content-Type (via a new honor_content_type flag) while output deserializers keep using the configured Accept type, to work around model servers that return misleading response headers like text/html. The change is small, backward compatible (falls back to self._accept[0] when content_type is None or when the flag is false), and the added unit tests cover the JSON/CSV input cases and the misleading-output case. No issues found.

Reviewed commit 9abb543. Automated review; verify before acting.

This branch was successfully deployed

1 active deployment
auto-approve — 9abb543a Deployed Oct 13, 2026 by lucasjia-aws via wait-for-approval #658
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.

DeserializerWrapper prevents the use of valid input Content-Types during inference - SageMaker endpoitns build with ModelBuilder and SchemaBuilder

1 participant