Template - Insert Post Data


(Marvin Koch) #1

Hey there,

I currently getting a POST to my /index.html - As I’m using a static.js it is not possible to accept the POST-Data on this end.

So I noticed, that Caddy Supports Templates and that it is possible to output some of the Request Information. But I’m not able to output some of the POST data I receive.

If this is possible, how?

I tried
{{.Req.Body}}
{{.Header}}

And a couple of other keywords I could find.

Also not sure what {{.Req.Body}} is returing ({0xc4204e40a0 0xc4200b5c40})

Thanks


(Matt Holt) #2

Request body is returning a pointer to a Reader, because it’s a stream. I’m not sure how good of an idea it would be to dump request data into a template, not without proper size limits and sanitization controls… hm…