Skip to content

Accept POST as well as GET on the CATMAID pass-through - #99

Merged
Robbie1977 merged 1 commit into
mainfrom
catmaid-passthrough-post-support
Aug 30, 2026
Merged

Accept POST as well as GET on the CATMAID pass-through#99
Robbie1977 merged 1 commit into
mainfrom
catmaid-passthrough-post-support

Conversation

@Robbie1977

Copy link
Copy Markdown
Contributor

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 POST route on the same path, reading parameters from a JSON body or a form-encoded body instead of the query string. project/raw stay 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.

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.
@Robbie1977
Robbie1977 merged commit 475018d into main Aug 30, 2026
4 of 5 checks passed
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.

2 participants