Skip to content

fix(http-server-js): send bytes body directly without JSON serialization#10610

Open
snipd-mikel wants to merge 1 commit intomicrosoft:mainfrom
snipd-app:feature/fix-bytes-response
Open

fix(http-server-js): send bytes body directly without JSON serialization#10610
snipd-mikel wants to merge 1 commit intomicrosoft:mainfrom
snipd-app:feature/fix-bytes-response

Conversation

@snipd-mikel
Copy link
Copy Markdown

When an operation returns a bytes body with a custom @header contentType
(e.g. "application/zip"), the emitter was unconditionally overwriting the
content-type with "application/json" and calling the non-existent
Uint8Array.toJsonObject(), causing a runtime crash.

Add a isStdType(body.type, "bytes") check in emitResultProcessingForType
before the JSON serialization path — mirroring the equivalent check already
present on the request deserialization side (added in #6898) — so that binary
responses are written directly to the response stream with the content-type
already set by the @header property.

Fixes #10609

@snipd-mikel
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree [company="Snipd AG"]

@snipd-mikel
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree company="Snipd AG"

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.

[Bug]: http-server-js emitter generates incorrect response code for bytes body with custom content-type

1 participant