Skip to content

Commit 59dbb98

Browse files
author
Zakariah Chitty
committed
[docs] add stipulation to SetURLVars that it should only be used for testing purposes
1 parent f8f75ed commit 59dbb98

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

test_helpers.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ package mux
66

77
import "net/http"
88

9-
// SetURLVars sets URL variables. This can be used to simplify the testing of
10-
// request handlers.
11-
// Alternatively, URL variables can be set by making a route that captures the
12-
// required variables, starting a server and sending the request to that
13-
// server.
9+
// SetURLVars sets the URL variables for the given request, to be accessed via
10+
// mux.Vars for testing route behaviour.
11+
//
12+
// This API should only be used for testing purposes; it provides a way to
13+
// inject variables into the request context. Alternatively, URL variables
14+
// can be set by making a route that captures the required variables,
15+
// starting a server and sending the request to that server.
1416
func SetURLVars(r *http.Request, val map[string]string) *http.Request {
1517
return setVars(r, val)
1618
}

0 commit comments

Comments
 (0)