You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

20 lines
758 B

  1. // Copyright 2012 The Gorilla Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package mux
  5. import "net/http"
  6. // SetURLVars sets the URL variables for the given request, to be accessed via
  7. // mux.Vars for testing route behaviour. Arguments are not modified, a shallow
  8. // copy is returned.
  9. //
  10. // This API should only be used for testing purposes; it provides a way to
  11. // inject variables into the request context. Alternatively, URL variables
  12. // can be set by making a route that captures the required variables,
  13. // starting a server and sending the request to that server.
  14. func SetURLVars(r *http.Request, val map[string]string) *http.Request {
  15. return setVars(r, val)
  16. }