Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: gorilla/mux
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.7.0
Choose a base ref
...
head repository: gorilla/mux
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.7.1
Choose a head ref
  • 4 commits
  • 4 files changed
  • 3 contributors

Commits on Feb 17, 2019

  1. [docs] typo (#454)

    souvikhaldar authored and elithrar committed Feb 17, 2019
    Copy the full SHA
    8559a4f View commit details

Commits on Feb 28, 2019

  1. fix go1.12 go vet usage (#458)

    seriousben authored and kisielk committed Feb 28, 2019
    Copy the full SHA
    8eaa9f1 View commit details
  2. Copy the full SHA
    15a353a View commit details

Commits on Mar 16, 2019

  1. Copy the full SHA
    c5c6c98 View commit details
Showing with 13 additions and 6 deletions.
  1. +2 −2 .travis.yml
  2. +6 −0 mux.go
  3. +4 −3 mux_test.go
  4. +1 −1 route.go
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: go
sudo: false


matrix:
include:
@@ -20,5 +20,5 @@ install:
script:
- go get -t -v ./...
- diff -u <(echo -n) <(gofmt -d .)
- if [[ "$LATEST" = true ]]; then go tool vet .; fi
- if [[ "$LATEST" = true ]]; then go vet .; fi
- go test -v -race ./...
6 changes: 6 additions & 0 deletions mux.go
Original file line number Diff line number Diff line change
@@ -283,6 +283,12 @@ func (r *Router) NewRoute() *Route {
return route
}

// Name registers a new route with a name.
// See Route.Name().
func (r *Router) Name(name string) *Route {
return r.NewRoute().Name(name)
}

// Handle registers a new route with a matcher for the URL path.
// See Route.Path() and Route.Handler().
func (r *Router) Handle(path string, handler http.Handler) *Route {
7 changes: 4 additions & 3 deletions mux_test.go
Original file line number Diff line number Diff line change
@@ -1441,10 +1441,11 @@ func TestNamedRoutes(t *testing.T) {
r3.NewRoute().Name("g")
r3.NewRoute().Name("h")
r3.NewRoute().Name("i")
r3.Name("j")

if r1.namedRoutes == nil || len(r1.namedRoutes) != 9 {
t.Errorf("Expected 9 named routes, got %v", r1.namedRoutes)
} else if r1.Get("i") == nil {
if r1.namedRoutes == nil || len(r1.namedRoutes) != 10 {
t.Errorf("Expected 10 named routes, got %v", r1.namedRoutes)
} else if r1.Get("j") == nil {
t.Errorf("Subroute name not registered")
}
}
2 changes: 1 addition & 1 deletion route.go
Original file line number Diff line number Diff line change
@@ -383,7 +383,7 @@ func (r *Route) PathPrefix(tpl string) *Route {
// The above route will only match if the URL contains the defined queries
// values, e.g.: ?foo=bar&id=42.
//
// It the value is an empty string, it will match any value if the key is set.
// If the value is an empty string, it will match any value if the key is set.
//
// Variables can define an optional regexp pattern to be matched:
//