Skip to content

fix streaming accept header#1978

Open
sarptandoven wants to merge 1 commit into
openai:mainfrom
sarptandoven:fix/stream-accept-header
Open

fix streaming accept header#1978
sarptandoven wants to merge 1 commit into
openai:mainfrom
sarptandoven:fix/stream-accept-header

Conversation

@sarptandoven

Copy link
Copy Markdown

summary

  • set the default Accept header to text/event-stream when request options enable streaming
  • keep application/json for non-streaming requests
  • preserve caller-provided Accept headers for custom streaming transports

why

  • closes Inquiry about the 'Accept' header #375
  • streaming responses are returned as text/event-stream, and some OpenAI-compatible gateways validate the request Accept header before returning an SSE response
  • callers can already work around this with a manual header override; this makes the default client behavior match the expected response type

validation

  • pnpm exec jest tests/index.test.ts -t 'accept header' --runInBand
  • pnpm exec jest tests/index.test.ts --runInBand
  • pnpm exec tsc --noEmit --pretty false
  • git diff --check
  • pnpm lint
  • pnpm test

Use text/event-stream as the default Accept header when request options enable streaming while preserving explicit Accept overrides. Add regression coverage for streaming, non-streaming, and override cases.
@sarptandoven sarptandoven requested a review from a team as a code owner July 6, 2026 21:22
@HAYDEN-OAI HAYDEN-OAI added the upstream Needs to be addressed in Stainless upstream label Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

upstream Needs to be addressed in Stainless upstream

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inquiry about the 'Accept' header

2 participants