Skip to content

Commit 73a9743

Browse files
committed
test(node): exercise streamed byte-budget guard with chunked body
Use with_chunked_body instead of with_body so mockito sends no Content-Length, pinning the no-length streamed accumulation guard. Assert the "exceeded" message to distinguish from the declared-length check.
1 parent cb8999a commit 73a9743

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎crates/gl/src/task.rs‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1871,15 +1871,20 @@ mod tests {
18711871
.mock("GET", "/api/v1/tasks?limit=1")
18721872
.with_status(200)
18731873
.with_header("content-type", "application/json")
1874-
.with_body(large_payload)
1874+
.with_chunked_body(move |w: &mut dyn std::io::Write| {
1875+
w.write_all(large_payload.as_bytes())
1876+
})
18751877
.create_async()
18761878
.await;
18771879

18781880
let client = NodeClient::new(server.url(), None);
18791881
let err = fetch_tasks(&client, None, None, 1, None).await.unwrap_err();
1882+
// Must hit the streamed accumulation guard ("exceeded"), not the
1883+
// declared Content-Length check: with_chunked_body sends no
1884+
// Content-Length, pinning the no-length path.
18801885
assert!(err
18811886
.to_string()
1882-
.contains("task response exceeds byte budget"));
1887+
.contains("task response exceeds byte budget (exceeded"));
18831888
}
18841889

18851890
// ── Identity failure zero-network-request tests (#327 review) ────

0 commit comments

Comments
 (0)