diff --git a/engines/python/src/main/java/ai/djl/python/engine/RollingBatch.java b/engines/python/src/main/java/ai/djl/python/engine/RollingBatch.java index 6ee285c64..5eb191119 100644 --- a/engines/python/src/main/java/ai/djl/python/engine/RollingBatch.java +++ b/engines/python/src/main/java/ai/djl/python/engine/RollingBatch.java @@ -174,6 +174,11 @@ public void run() { BytesSupplier err = BytesSupplier.wrap(JsonUtils.GSON.toJson(out)); for (Request req : list) { req.last = true; + + // Note: This will only change the HTTP response code if the first chunk + // has not yet been sent + req.output.setCode(code); + req.data.appendContent(err, true); } list.clear();