rc: respond with 202 if prefer-async header is passed

Make rc respond with a 202 status code (instead of 200) if `Prefer: respond-
async` was passed. Keeps backwards compatibility for current clients while also
allowing the OpenAPI schema & generators to differentiate the responses
properly.
This commit is contained in:
FTCHD
2026-05-25 19:50:41 +01:00
committed by GitHub
parent 675806067a
commit 605eb30674
3 changed files with 65 additions and 12 deletions
+7
View File
@@ -267,6 +267,13 @@ It is recommended that potentially long running jobs, e.g. `sync/sync`,
flag to avoid any potential problems with the HTTP request and
response timing out.
As an alternative to `_async`, you can send the HTTP header
`Prefer: respond-async` (RFC 7240). This has the same effect as
`_async = true` but additionally returns HTTP status 202 (Accepted)
instead of 200, and includes a `Preference-Applied: respond-async`
response header. The 202 status code makes it easy for clients to distinguish
an async response from a completed one without inspecting the body.
Starting a job with the `_async` flag:
```console