Skip to content

fix(sdk): reject Content-Type in default headers - #740

Merged
sgbalogh merged 1 commit into
mainfrom
devin/1789160098-reject-default-content-type
Sep 11, 2026
Merged

sgbalogh merged 1 commit into
mainfrom
devin/1789160098-reject-default-content-type

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Reject Content-Type in S2Config::with_default_headers, alongside the existing encoding/framing restrictions. The SDK chooses the protocol for each operation: a default Content-Type: s2s/proto can make a unary read receive streaming frames, causing a decode error or timeout.

This addresses #737 at configuration validation, as an alternative to the per-read override in #738. All Content-Type values are rejected because request format belongs to the SDK.

Extend the existing rejection tests to cover S2S, protobuf, JSON, mixed-case header names, and empty values. Remove the now-invalid Content-Type default from the header propagation fixture while preserving its assertions.

Validation: the five new cases failed before the fix. just test passes all 796 workspace tests; SDK clippy with all features/targets and just fmt also pass.

Closes #737

Link to Devin session: https://app.devin.ai/sessions/c3dea6e292ce4071a41baf4943f1557c
Open in Devin Desktop: https://app.devin.ai/desktop/session/c3dea6e292ce4071a41baf4943f1557c?variant=devin
Requested by: @sgbalogh

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@greptile-apps

greptile-apps Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR prevents hidden SDK configuration from supplying a default Content-Type, ensuring each operation retains control of its request protocol.

  • Adds Content-Type to the headers rejected by S2Config::with_default_headers.
  • Tests rejection across S2S, protobuf, JSON, mixed-case, and empty values.
  • Updates the default-header propagation fixture to comply with the tightened validation.

Confidence Score: 5/5

The PR appears safe to merge with no actionable correctness, security, or repository-rule issues identified.

The validation consistently rejects case-insensitive Content-Type defaults before request construction, tests the relevant value variants, and leaves operation-specific Content-Type selection intact.

Important Files Changed

Filename Overview
sdk/src/types.rs Extends default-header validation and its parameterized tests to reject every Content-Type value.
sdk/src/api.rs Removes the newly invalid Content-Type entry from the header-propagation fixture while retaining verification of the SDK-selected streaming type.

Reviews (1): Last reviewed commit: "fix(sdk): reject Content-Type in default..." | Re-trigger Greptile

@sgbalogh
sgbalogh merged commit a271f7d into main Sep 11, 2026
22 checks passed
@sgbalogh
sgbalogh deleted the devin/1789160098-reject-default-content-type branch September 11, 2026 21:11
@release-pleaze release-pleaze Bot mentioned this pull request Sep 11, 2026
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.

[Detail Bug] SDK: Unary records read fails when default Content-Type is set to s2s/proto

1 participant