From 00deb291e3dffbfbc2c3eaff95147c4375cebec8 Mon Sep 17 00:00:00 2001 From: Alex Hultman Date: Sat, 13 Nov 2021 11:59:47 +0100 Subject: [PATCH] Add endWithoutBody --- src/HttpResponse.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/HttpResponse.h b/src/HttpResponse.h index 606eaf0..f6b2cff 100644 --- a/src/HttpResponse.h +++ b/src/HttpResponse.h @@ -379,6 +379,11 @@ public: return this; } + /* End without a body (no content-length) or end with a spoofed content-length. */ + void endWithoutBody(std::optional reportedContentLength = std::nullopt, bool closeConnection = false) { + internalEnd({nullptr, 0}, false, false, closeConnection); + } + /* End the response with an optional data chunk. Always starts a timeout. */ void end(std::string_view data = {}, bool closeConnection = false) { internalEnd(data, data.length(), false, true, closeConnection);