-
-
Couldn't load subscription status.
- Fork 502
Description
In upgrading to Crow version 1.2.1.2, we encountered an unexpected change in how res.is_completed() behaves during request handling.
Previously, our API logic used res.is_completed() to determine if the response had already been finalized. This allowed us to short-circuit execution paths and avoid duplicate response handling in specific routes. However, after updating to 1.2.1.2, these same endpoints began consistently returning 400 Bad Request responses in cases where we rely on res.is_completed() to decide early exit conditions.
Upon investigation, we traced the issue to a change introduced in commit #799. In this commit, response writing was made synchronous, and the completed_ flag appears to be reset (cleared) after res.end() is called. As a result, calls to res.is_completed() in our logic immediately following res.end() now return false instead of true, breaking our previous flow control.
We’ve temporarily reverted to Crow 1.2 to restore the expected behavior.
Could you clarify the intended usage and contract of res.is_completed() going forward, particularly in light of this commit?
Is the response expected to appear "incomplete" until the write fully finishes now?
Thanks in advance
example of our flow control:
`
void Authorize(const crow::request& req, crow::response& res)
{
...
res = crow::response(crow::status::OK, "okay");
res.end();
return;
}
`
`
this->Authorize(req, res);
if (res.is_completed()) return;
res = crow::response(crow::status::BAD_REQUEST);
res.end();
return;
`