aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/github.com/gorilla/mux/mux_test.go
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2018-07-06 21:18:14 -0700
committerGravatar Frédéric Guillot <fred@miniflux.net>2018-07-06 21:18:14 -0700
commit459bb4531f92f8663afb6f36aa9be5b789bd591f (patch)
treef14e6c06b8e5c63612d1ff36f8cab40ae8a99d20 /vendor/github.com/gorilla/mux/mux_test.go
parent34a3fe426b33a63f2d8e02d4a70c88f137fa5410 (diff)
Update vendor dependencies
Diffstat (limited to 'vendor/github.com/gorilla/mux/mux_test.go')
-rw-r--r--vendor/github.com/gorilla/mux/mux_test.go17
1 files changed, 17 insertions, 0 deletions
diff --git a/vendor/github.com/gorilla/mux/mux_test.go b/vendor/github.com/gorilla/mux/mux_test.go
index 9e93c98..af21329 100644
--- a/vendor/github.com/gorilla/mux/mux_test.go
+++ b/vendor/github.com/gorilla/mux/mux_test.go
@@ -2248,6 +2248,15 @@ func TestMethodsSubrouterPathVariable(t *testing.T) {
}
}
+func ExampleSetURLVars() {
+ req, _ := http.NewRequest("GET", "/foo", nil)
+ req = SetURLVars(req, map[string]string{"foo": "bar"})
+
+ fmt.Println(Vars(req)["foo"])
+
+ // Output: bar
+}
+
// testMethodsSubrouter runs an individual methodsSubrouterTest.
func testMethodsSubrouter(t *testing.T, test methodsSubrouterTest) {
// Execute request
@@ -2306,6 +2315,14 @@ func stringMapEqual(m1, m2 map[string]string) bool {
return true
}
+// stringHandler returns a handler func that writes a message 's' to the
+// http.ResponseWriter.
+func stringHandler(s string) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ w.Write([]byte(s))
+ }
+}
+
// newRequest is a helper function to create a new request with a method and url.
// The request returned is a 'server' request as opposed to a 'client' one through
// simulated write onto the wire and read off of the wire.