Accept POST as well as GET on the CATMAID pass-through - #99
Merged
Conversation
Bulk-id commands (compact_detail, annotations_for_skeletons,
connectivity, ...) already send their ids to CATMAID as a POST body
internally, but the client-facing /catmaid/{instance}/{command} route
only accepted GET, so callers had to put the same ids in the query
string. Past ~1000 ids that trips nginx's default header-buffer limit
with a 414, forcing bulk callers to chunk into several requests, each
carrying the same failure mode.
Add a POST route for the same path, reading parameters from a JSON
body or an application/x-www-form-urlencoded/multipart form instead
of the query string. `project` and `raw` stay on the query string for
both verbs, since they're view flags rather than command payload. The
cache key doesn't include the HTTP method, so a GET and the
equivalent POST share one cache entry rather than warming it twice.
GET is unchanged and remains fully supported.
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.
Fixes issue 2 from Philip's feedback: bulk-id commands (
compact_detail,annotations_for_skeletons,connectivity, ...) already send their ids to CATMAID as a POST body internally, but the client-facing/catmaid/{instance}/{command}route only accepted GET — so callers had to put the same ids in the query string, which trips nginx's default header-buffer limit with a 414 above ~1000 ids.Adds a
POSTroute on the same path, reading parameters from a JSON body or a form-encoded body instead of the query string.project/rawstay on the query string for both verbs. The cache key doesn't include the HTTP method, so an equivalent GET and POST share one cache entry.GET is unchanged. Verified end-to-end against live production CATMAID: GET and POST return byte-identical results for the same ids, and a 1499-id POST (which 414s as a GET) succeeds cleanly. New unit tests cover body parsing (JSON/form/malformed) and GET/POST parameter parity.