Skip to content

Commit

Permalink
Merge pull request #48 from vibe-d/redo_25
Browse files Browse the repository at this point in the history
Add writeBody() method with status code for stream version.
  • Loading branch information
s-ludwig authored Nov 11, 2024
2 parents d4f2619 + c1e873b commit 338ecb4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion source/vibe/http/server.d
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
Expand Down

0 comments on commit 338ecb4

Please sign in to comment.