Skip to content

Commit 5effb65

Browse files
committed
Rename VIEW -> View
1 parent 282fc8f commit 5effb65

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,14 +329,14 @@ func init() {
329329
}
330330

331331
func home(w http.ResponseWriter, r *http.Request) {
332-
err := rnd.VIEW(w, http.StatusOK, "home", nil)
332+
err := rnd.View(w, http.StatusOK, "home", nil)
333333
if err != nil {
334334
log.Fatal(err)
335335
}
336336
}
337337

338338
func about(w http.ResponseWriter, r *http.Request) {
339-
err := rnd.VIEW(w, http.StatusOK, "about", nil)
339+
err := rnd.View(w, http.StatusOK, "about", nil)
340340
if err != nil {
341341
log.Fatal(err)
342342
}

renderer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,8 @@ func (r *Render) Template(w http.ResponseWriter, status int, tpls []string, v in
412412
return err
413413
}
414414

415-
// VIEW build html from template directory and serve html content as response. See README.md for detail example.
416-
func (r *Render) VIEW(w http.ResponseWriter, status int, name string, v interface{}) error {
415+
// View build html from template directory and serve html content as response. See README.md for detail example.
416+
func (r *Render) View(w http.ResponseWriter, status int, name string, v interface{}) error {
417417
w.Header().Set(ContentType, r.opts.ContentHTML)
418418
w.WriteHeader(status)
419419

renderer_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ func Test_View(t *testing.T) {
519519
expected := `<html><head><title>Home</title></head><body><h3>Home page</h3><ul><li><a href="/">Home</a></li><li><a href="/about">About Me</a></li></ul><p>Lorem ipsum dolor sit amet</p></body></html>`
520520

521521
h := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
522-
err = r.VIEW(w, http.StatusOK, "home", nil)
522+
err = r.View(w, http.StatusOK, "home", nil)
523523
})
524524

525525
res := httptest.NewRecorder()
@@ -554,7 +554,7 @@ func Test_View_invalid_name(t *testing.T) {
554554
)
555555

556556
h := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
557-
err = r.VIEW(w, http.StatusOK, "invalid template", nil)
557+
err = r.View(w, http.StatusOK, "invalid template", nil)
558558
})
559559

560560
res := httptest.NewRecorder()

0 commit comments

Comments
 (0)