Skip to content

Commit 10e8fd1

Browse files
jmcarpelithrar
authored andcommitted
[docs] Fix a few minor typos in examples. (#54)
* Fix package import * Explicitly load templates * Fix `HandleFunc` invocation
1 parent fdae182 commit 10e8fd1

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

csrf.go

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,25 @@ type options struct {
8989
// package main
9090
//
9191
// import (
92-
// "github.com/elithrar/protect"
92+
// "html/template"
93+
//
94+
// "github.com/gorilla/csrf"
9395
// "github.com/gorilla/mux"
9496
// )
9597
//
98+
// var t = template.Must(template.New("signup_form.tmpl").Parse(form))
99+
//
96100
// func main() {
97-
// r := mux.NewRouter()
101+
// r := mux.NewRouter()
98102
//
99-
// mux.HandlerFunc("/signup", GetSignupForm)
100-
// // POST requests without a valid token will return a HTTP 403 Forbidden.
101-
// mux.HandlerFunc("/signup/post", PostSignupForm)
103+
// r.HandleFunc("/signup", GetSignupForm)
104+
// // POST requests without a valid token will return a HTTP 403 Forbidden.
105+
// r.HandleFunc("/signup/post", PostSignupForm)
102106
//
103-
// // Add the middleware to your router.
104-
// http.ListenAndServe(":8000",
105-
// // Note that the authentication key provided should be 32 bytes
106-
// // long and persist across application restarts.
107+
// // Add the middleware to your router.
108+
// http.ListenAndServe(":8000",
109+
// // Note that the authentication key provided should be 32 bytes
110+
// // long and persist across application restarts.
107111
// csrf.Protect([]byte("32-byte-long-auth-key"))(r))
108112
// }
109113
//

0 commit comments

Comments
 (0)