func (re *Redirect) Render(res *wcg.Response, req *wcg.Request) { url := re.URL if !strings.HasPrefix(url, "http://") && strings.HasPrefix(url, "https://") { url = wcg.AbsoluteURL(req, url) } res.Redirect(url, int(re.StatusCode)) }
func (resp *TextResponse) Render(res *wcg.Response, req *wcg.Request) { res.WriteHeader(resp.StatusCode) res.WriteString(resp.Text) res.Close() }
func (pr *PageResponse) Render(res *wcg.Response, req *wcg.Request) { res.SetLocal("Request", req) res.SetLocal("SiteConfig", generateSiteConfigs(req)) res.SetLocal("CSRFToken", generateCSRFToken(req)) res.SetLocal("Page", pr) res.SetLocal("StaticTimestamp", wcg.FormatDateTime(lib.StartTime)) res.TemplatesWithStatus(pr.StatusCode, nil, pr.GetTemplates(req)...) }
func (resp *JSONResponse) Render(res *wcg.Response, req *wcg.Request) { res.WriteJSONWithStatus(resp.StatusCode, nil, resp.Data) }