diff options
author | 2018-04-27 20:38:46 -0700 | |
---|---|---|
committer | 2018-04-27 20:38:46 -0700 | |
commit | 6b360d08c1f6c8a6cd1b7608f7af734a3ceef8d7 (patch) | |
tree | 48352d35fa9f3559df05accf4ce4fce1672a2830 /vendor/github.com/gorilla/mux/test_helpers.go | |
parent | 322b265d7aec7731f7fa703c9a74ceb61ae73f3f (diff) | |
download | v2-6b360d08c1f6c8a6cd1b7608f7af734a3ceef8d7.tar.gz v2-6b360d08c1f6c8a6cd1b7608f7af734a3ceef8d7.tar.zst v2-6b360d08c1f6c8a6cd1b7608f7af734a3ceef8d7.zip |
Use Gorilla middleware (refactoring)
Diffstat (limited to 'vendor/github.com/gorilla/mux/test_helpers.go')
-rw-r--r-- | vendor/github.com/gorilla/mux/test_helpers.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/vendor/github.com/gorilla/mux/test_helpers.go b/vendor/github.com/gorilla/mux/test_helpers.go new file mode 100644 index 00000000..8b2c4a4c --- /dev/null +++ b/vendor/github.com/gorilla/mux/test_helpers.go @@ -0,0 +1,18 @@ +// Copyright 2012 The Gorilla Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package mux + +import "net/http" + +// SetURLVars sets the URL variables for the given request, to be accessed via +// mux.Vars for testing route behaviour. +// +// This API should only be used for testing purposes; it provides a way to +// inject variables into the request context. Alternatively, URL variables +// can be set by making a route that captures the required variables, +// starting a server and sending the request to that server. +func SetURLVars(r *http.Request, val map[string]string) *http.Request { + return setVars(r, val) +} |