fix(http-server-js): send bytes body directly without JSON serialization#10610
fix(http-server-js): send bytes body directly without JSON serialization#10610snipd-mikel wants to merge 1 commit into
Conversation
|
@microsoft-github-policy-service agree [company="Snipd AG"] |
|
@microsoft-github-policy-service agree company="Snipd AG" |
commit: |
|
❌ There is undocummented changes. Run The following packages have changes but are not documented.
Show changes |
|
@snipd-mikel I think this is an improvement over what we have now, but it's not always correct to treat There's also another more explicit way to declare an API that transmits a file if that's what you are looking to do ( I appreciate the contribution, but I put up a PR that I think gets us a more accurate treatment of |
When an operation returns a
bytesbody with a custom@header contentType(e.g.
"application/zip"), the emitter was unconditionally overwriting thecontent-type with
"application/json"and calling the non-existentUint8Array.toJsonObject(), causing a runtime crash.Add a
isStdType(body.type, "bytes")check inemitResultProcessingForTypebefore 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
@headerproperty.Fixes #10609