Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:thedevsaddam/renderer into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
thedevsaddam committed Dec 28, 2017
2 parents d388822 + 3d25f66 commit 05b59a3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package renderer
==================
[![Build Status](https://travis-ci.org/thedevsaddam/renderer.svg?branch=master)](https://travis-ci.org/thedevsaddam/renderer)
[![Project status](https://img.shields.io/badge/version-1.0-green.svg)](https://github.com/thedevsaddam/renderer/releases)
[![Project status](https://img.shields.io/badge/version-1.1-green.svg)](https://github.com/thedevsaddam/renderer/releases)
[![Go Report Card](https://goreportcard.com/badge/github.com/thedevsaddam/renderer)](https://goreportcard.com/report/github.com/thedevsaddam/renderer)
[![Coverage Status](https://coveralls.io/repos/github/thedevsaddam/renderer/badge.svg?branch=master)](https://coveralls.io/github/thedevsaddam/renderer?branch=master)
[![GoDoc](https://godoc.org/github.com/thedevsaddam/renderer?status.svg)](https://godoc.org/github.com/thedevsaddam/renderer)
Expand Down Expand Up @@ -56,6 +56,11 @@ func main() {
rnd.NoContent(w)
})

// serving string as html
mux.HandleFunc("/html-string", func(w http.ResponseWriter, r *http.Request) {
rnd.HTMLString(w, http.StatusOK, "<h1>Hello Renderer!</h1>")
})

// serving JSON
mux.HandleFunc("/json", func(w http.ResponseWriter, r *http.Request) {
rnd.JSON(w, http.StatusOK, usr)
Expand Down
2 changes: 1 addition & 1 deletion renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ func (r *Render) YAML(w http.ResponseWriter, status int, v interface{}) error {
return err
}

// HTMLString render string as html
// HTMLString render string as html. Note: You must provide trusted html when using this method
func (r *Render) HTMLString(w http.ResponseWriter, status int, html string) error {
w.Header().Set(ContentType, r.opts.ContentHTML)
w.WriteHeader(status)
Expand Down

0 comments on commit 05b59a3

Please sign in to comment.