Skip to content

Commit fcd4636

Browse files
committed
Doc update r -> rnd
1 parent fca902c commit fcd4636

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

README.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import (
3737
)
3838

3939
func main() {
40-
r := renderer.New()
40+
rnd := renderer.New()
4141

4242
mux := http.NewServeMux()
4343

@@ -47,63 +47,63 @@ func main() {
4747
}{"John Doe", 30}
4848

4949
// serving String as text/plain
50-
mux.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) {
51-
r.String(w, http.StatusOK, "Welcome to renderer")
50+
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
51+
rnd.String(w, http.StatusOK, "Welcome to renderer")
5252
})
5353

5454
// serving success but no content
55-
mux.HandleFunc("/no-content", func(w http.ResponseWriter, req *http.Request) {
56-
r.NoContent(w)
55+
mux.HandleFunc("/no-content", func(w http.ResponseWriter, r *http.Request) {
56+
rnd.NoContent(w)
5757
})
5858

5959
// serving JSON
60-
mux.HandleFunc("/json", func(w http.ResponseWriter, req *http.Request) {
61-
r.JSON(w, http.StatusOK, usr)
60+
mux.HandleFunc("/json", func(w http.ResponseWriter, r *http.Request) {
61+
rnd.JSON(w, http.StatusOK, usr)
6262
})
6363

6464
// serving JSONP
65-
mux.HandleFunc("/jsonp", func(w http.ResponseWriter, req *http.Request) {
66-
r.JSONP(w, http.StatusOK, "callback", usr)
65+
mux.HandleFunc("/jsonp", func(w http.ResponseWriter, r *http.Request) {
66+
rnd.JSONP(w, http.StatusOK, "callback", usr)
6767
})
6868

6969
// serving XML
70-
mux.HandleFunc("/xml", func(w http.ResponseWriter, req *http.Request) {
71-
r.XML(w, http.StatusOK, usr)
70+
mux.HandleFunc("/xml", func(w http.ResponseWriter, r *http.Request) {
71+
rnd.XML(w, http.StatusOK, usr)
7272
})
7373

7474
// serving YAML
75-
mux.HandleFunc("/yaml", func(w http.ResponseWriter, req *http.Request) {
76-
r.YAML(w, http.StatusOK, usr)
75+
mux.HandleFunc("/yaml", func(w http.ResponseWriter, r *http.Request) {
76+
rnd.YAML(w, http.StatusOK, usr)
7777
})
7878

7979
// serving File as arbitary binary data
80-
mux.HandleFunc("/binary", func(w http.ResponseWriter, req *http.Request) {
80+
mux.HandleFunc("/binary", func(w http.ResponseWriter, r *http.Request) {
8181
var reader io.Reader
8282
reader, _ = os.Open("../README.md")
83-
r.Binary(w, http.StatusOK, reader, "readme.md", true)
83+
rnd.Binary(w, http.StatusOK, reader, "readme.md", true)
8484
})
8585

8686
// serving File as inline
87-
mux.HandleFunc("/file-inline", func(w http.ResponseWriter, req *http.Request) {
88-
r.FileView(w, http.StatusOK, "../README.md", "readme.md")
87+
mux.HandleFunc("/file-inline", func(w http.ResponseWriter, r *http.Request) {
88+
rnd.FileView(w, http.StatusOK, "../README.md", "readme.md")
8989
})
9090

9191
// serving File as attachment
92-
mux.HandleFunc("/file-download", func(w http.ResponseWriter, req *http.Request) {
93-
r.FileDownload(w, http.StatusOK, "../README.md", "readme.md")
92+
mux.HandleFunc("/file-download", func(w http.ResponseWriter, r *http.Request) {
93+
rnd.FileDownload(w, http.StatusOK, "../README.md", "readme.md")
9494
})
9595

9696
// serving File from reader as inline
97-
mux.HandleFunc("/file-reader", func(w http.ResponseWriter, req *http.Request) {
97+
mux.HandleFunc("/file-reader", func(w http.ResponseWriter, r *http.Request) {
9898
var reader io.Reader
9999
reader, _ = os.Open("../README.md")
100-
r.File(w, http.StatusOK, reader, "readme.md", true)
100+
rnd.File(w, http.StatusOK, reader, "readme.md", true)
101101
})
102102

103103
// serving custom response using render and chaining methods
104-
mux.HandleFunc("/render", func(w http.ResponseWriter, req *http.Request) {
104+
mux.HandleFunc("/render", func(w http.ResponseWriter, r *http.Request) {
105105
w.Header().Set(renderer.ContentType, renderer.ContentText)
106-
r.Render(w, http.StatusOK, []byte("Send the message as text response"))
106+
rnd.Render(w, http.StatusOK, []byte("Send the message as text response"))
107107
})
108108

109109
port := ":9000"
@@ -179,7 +179,7 @@ func toUpper(s string) string {
179179
return strings.ToUpper(s)
180180
}
181181

182-
func handler(w http.ResponseWriter, req *http.Request) {
182+
func handler(w http.ResponseWriter, r *http.Request) {
183183
usr := struct {
184184
Name string
185185
Age int
@@ -258,7 +258,7 @@ func init() {
258258
)
259259
}
260260

261-
func handler(w http.ResponseWriter, req *http.Request) {
261+
func handler(w http.ResponseWriter, r *http.Request) {
262262
err := r.HTML(w, http.StatusOK, "indexPage", nil)
263263
if err != nil {
264264
log.Fatal(err)
@@ -336,14 +336,14 @@ func init() {
336336
}
337337
}
338338

339-
func home(w http.ResponseWriter, req *http.Request) {
339+
func home(w http.ResponseWriter, r *http.Request) {
340340
err = r.VIEW(w, http.StatusOK, "home", nil)
341341
if err != nil {
342342
log.Fatal(err)
343343
}
344344
}
345345

346-
func about(w http.ResponseWriter, req *http.Request) {
346+
func about(w http.ResponseWriter, r *http.Request) {
347347
err = r.VIEW(w, http.StatusOK, "about", nil)
348348
if err != nil {
349349
log.Fatal(err)

0 commit comments

Comments
 (0)