func (r *Request) RenderTemplate(
	assert audit.Assertion,
	contentType string,
	templateSource string,
	data interface{},
) *Request {
	// Render template.
	t, err := template.New(r.Path).Parse(templateSource)
	assert.Nil(err, "cannot parse template")
	body := &bytes.Buffer{}
	err = t.Execute(body, data)
	assert.Nil(err, "cannot render template")
	r.Body = body.Bytes()
	// Set content type.
	r.AddHeader(HeaderContentType, contentType)
	r.AddHeader(HeaderAccept, contentType)
	return r
}
// RenderTemplate renders the passed data into the template
// and assigns it to the request body. The content type
// will be set too.
RenderTemplate renders the passed data into the template
and assigns it to the request body. The content type
will be set too.
// RenderTemplate renders the passed data into the template // and assigns it to the request body . The content type // will be set too .
func (r *Request) RenderTemplate(
	assert audit.Assertion,
	contentType string,
	templateSource string,
	data interface{},
) *Request {
	t, err := template.New(r.Path).Parse(templateSource)
	assert.Nil(err, "cannot parse template")
	body := &bytes.Buffer{}
	err = t.Execute(body, data)
	assert.Nil(err, "cannot render template")
	r.Body = body.Bytes()
	r.AddHeader(HeaderContentType, contentType)
	r.AddHeader(HeaderAccept, contentType)
	return r
}
func ( r * Request ) RenderTemplate ( assert audit . Assertion , contentType string , templateSource string , data interface { } , ) * Request { t , err := template . New ( r . Path ) . Parse ( templateSource ) assert . Nil ( err , " " ) body := & bytes . Buffer { } err = t . Execute ( body , data ) assert . Nil ( err , " " ) r . Body = body . Bytes ( ) r . AddHeader ( HeaderContentType , contentType ) r . AddHeader ( HeaderAccept , contentType ) return r }
RenderTemplate renders the passed data into the template
and assigns it to the request body.
RenderTemplate renders the passed data into the template and assigns it to the request body .
// Render template. // Set content type.