Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

test_helpers.go 758 B

5 år sedan
12345678910111213141516171819
  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. }