digitalmars.D.learn - vibe.d get body of HTTPServerResponse
- JG (4/4) Nov 02 2020 I am trying to get the body the response generated by:
- Steven Schveighoffer (11/19) Nov 02 2020 That is a convenience wrapper to diet-ng:
- JG (3/22) Nov 02 2020 Thank you very much.
I am trying to get the body the response generated by: res.render!("index.dt"); where res is of type HTTPServerResponse Does anyone know how I might go about this?
Nov 02 2020
On 11/2/20 10:10 AM, JG wrote:I am trying to get the body the response generated by: res.render!("index.dt"); where res is of type HTTPServerResponse Does anyone know how I might go about this?That is a convenience wrapper to diet-ng: https://github.com/vibe-d/vibe.d/blob/70b50fdb9cd4144f1a5007b36e6ac39d4731c140/http/vibe/http/server.d#L337-L346 Instead, create your own output range (maybe a char[] appender?) and compile to that yourself: import diet.html : compileHTMLDietFile; import std.array : appdender; auto app = appender!(char[]); compileHTMLDietFile!("index.dt")(app); auto resultingHTML = app.data; -Steve
Nov 02 2020
On Monday, 2 November 2020 at 17:02:01 UTC, Steven Schveighoffer wrote:On 11/2/20 10:10 AM, JG wrote:Thank you very much.I am trying to get the body the response generated by: res.render!("index.dt"); where res is of type HTTPServerResponse Does anyone know how I might go about this?That is a convenience wrapper to diet-ng: https://github.com/vibe-d/vibe.d/blob/70b50fdb9cd4144f1a5007b36e6ac39d4731c140/http/vibe/http/server.d#L337-L346 Instead, create your own output range (maybe a char[] appender?) and compile to that yourself: import diet.html : compileHTMLDietFile; import std.array : appdender; auto app = appender!(char[]); compileHTMLDietFile!("index.dt")(app); auto resultingHTML = app.data; -Steve
Nov 02 2020