Skip to content

http-server-js: handle raw bytes responses with unknown content-types and Http.File response bodies#10799

Open
witemple-msft wants to merge 4 commits into
microsoft:mainfrom
witemple-msft:hsjs-bytes-body-payload
Open

http-server-js: handle raw bytes responses with unknown content-types and Http.File response bodies#10799
witemple-msft wants to merge 4 commits into
microsoft:mainfrom
witemple-msft:hsjs-bytes-body-payload

Conversation

@witemple-msft
Copy link
Copy Markdown
Member

This pull request corrects the handling of bytes responses when they should be treated as raw bytes while preserving JSON-encoding of bytes payloads. It also implements support for Http.File responses with arbitrary content-types and implements setting the filename using the content-disposition header (we always use the "attachment" disposition).

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 26, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http-server-js@10799

commit: cd3e012

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 26, 2026

All changed packages have been documented.

  • @typespec/http-server-js
Show changes

@typespec/http-server-js - fix ✏️

Fixed an issue with handling of bytes response bodies with content-types other than "application/json" that would cause http-server-js to emit an invalid attempt to call Uint8Array.toJsonObject.

@typespec/http-server-js - feature ✏️

Added support for Http.File response bodies. File bodies are treated as raw bytes, and the filename is represented in the Content-Disposition header.

@azure-sdk-automation
Copy link
Copy Markdown

azure-sdk-automation Bot commented May 26, 2026

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

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.

1 participant