From a1c247cabfa005ccb14fcfd79b10240cc4ada640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Mon, 11 Nov 2024 10:35:09 +0100 Subject: [PATCH] Add writeBody() method with status code for stream version. This is a rebased version of #25 by @ljmf00 Fixes #25. --- source/vibe/http/server.d | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/vibe/http/server.d b/source/vibe/http/server.d index ca4973a..80d94cc 100644 --- a/source/vibe/http/server.d +++ b/source/vibe/http/server.d @@ -1307,6 +1307,12 @@ scope: else if ("Content-Type" !in headers) headers["Content-Type"] = "application/octet-stream"; data.pipe(bodyWriter); } + /// ditto + void writeBody(scope InputStream data, int status, string content_type = null) + { + statusCode = status; + writeBody(data, content_type); + } /** Writes the entire response body as a single string. @@ -1320,7 +1326,6 @@ scope: See_Also: `HTTPStatusCode` */ - /// ditto void writeBody(string data, string content_type = null) @safe { if (!content_type.length && "Content-Type" !in headers)