Repository navigation
Forward TypeSafe image opt-in and multipart uploads for Jev - #161
Open
skyfallwastaken wants to merge 2 commits into
Open
skyfallwastaken wants to merge 2 commits into
skyfallwastaken wants to merge 2 commits into
Conversation
The Jev route built its upstream headers from scratch, so a client's TypeSafe-Danger-Zone-Images: true never reached TypeSafe and image requests were rejected. Amp-Thread-ID: https://ampcode.com/threads/T-01a17a1f-c07b-7201-a05b-7e5423f4420a Co-authored-by: Mahad Kalam <[email protected]>
TypeSafe takes images as file parts of a multipart/form-data request whose request part holds the JSON body. The route only read JSON, so those uploads failed with a 400. It now validates and defaults the model in the request part and forwards the form with its file parts. Amp-Thread-ID: https://ampcode.com/threads/T-01a17a1f-c07b-7201-a05b-7e5423f4420a Co-authored-by: Mahad Kalam <[email protected]>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jev image requests failed for two reasons.
TypeSafe-Danger-Zone-Images: truenever reached TypeSafe, which rejects image requests without it. The route now forwards everyTypeSafe-Danger-Zone-*header on/systemoneand/models. Other client headers are still dropped.multipart/form-data, with the JSON body in arequestpart and each image as a file part. The route only read JSON, so these returned 400. It now abuse-screens therequestpart, validates and defaults the model the same as for JSON, and forwards the form with its file parts unchanged. Analytics store only the JSON part.data_base64image + opt-in headerVerified with two regression tests that fail without the change, the full gateway suite (135 pass), typecheck, svelte-check, and a scratch end-to-end
curl -Frun through a real HTTP gateway against a fake TypeSafe server. Image bytes arrived unchanged, and bad models and missing keys were still rejected. Not exercised against the live TypeSafe API.Not covered: the TypeSafe JS SDK zstd-compresses request bodies of 1 KiB or more by default on Node 22.15+, and the gateway answers those with 400. SDK users need
compression: falseuntil request bodies are decompressed.