Repository navigation
SWF(bug): allow DELETE in the server's CORS preflight - #55
Merged
Merged
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
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.
Summary
Browsers could not call any of spark-server's DELETE endpoints cross-origin: the CORS preflight now allows
DELETE.Root cause:
build_and_serveinserve_router.rsbuilt itsCorsLayerwithallow_methods([GET, POST, OPTIONS]), but the router registers DELETE routes (/v1/responses/{id},/v1/conversations/{id},/v1/conversations/{id}/items/{item_id}, batches, files). A browser'sOPTIONSpreflight forDELETEgotaccess-control-allow-methods: GET,POST,OPTIONS, so the browser blocked the actual request. Fix: addMethod::DELETE, with the layer moved into acors_layer()helper so the test exercises the exact production layer.Test plan
Regression test
main_modules::serve_router::tests::cors_preflight_allows_deletesends a real preflight (Origin+Access-Control-Request-Method: DELETE) throughcors_layer().Before the fix (fails):
After the fix (passes):
Full
sparkbinary suite:test result: ok. 3220 passed; 0 failed; 14 ignored.Live check against the real
spark servebinary (no model, GPU-free):access-control-allow-methodsGET,POST,OPTIONSGET,POST,DELETE,OPTIONSTry it (with
spark serve --port 18080running):cargo fmt --all -- --checkATLAS_SKIP_BUILD=1 CUDARC_CUDA_VERSION=13000 cargo clippy --workspace --testsbash scripts/check-license-headers.shtyposNotes for reviewers
Untested: an actual browser
fetch(..., {method: 'DELETE'})from another origin (verified via the preflight headers only), and GPU/model serving.CLA
Implemented in session Allow DELETE in the server's CORS preflight
Review with Devin · Open in Devin Desktop