🚀 gorilla/mux - Release Notes

Release v1.8.1 (2023-11-05)

## What's Changed
* build: CircleCI 2.1 + build matrix by @elithrar in https://github.com/gorilla/mux/pull/595
* Include "404" and "405" in the docs by @Jille in https://github.com/gorilla/mux/pull/602
* docs: update README w.r.t new maintainer ask by @elithrar in https://github.com/gorilla/mux/pull/660
* regexp: use iota instead of hardcoded values for regexType* by @michaelgrigoryan25 in https://github.com/gorilla/mux/pull/679
* Fix `authenticationMiddleware` initialization in the `README.md` file by @amustaque97 in https://github.com/gorilla/mux/pull/693
* Update README.md by @coreydaley in https://github.com/gorilla/mux/pull/713
* [GPT-95] Update go version, add tools for verification and testing by @apoorvajagtap in https://github.com/gorilla/mux/pull/718
* Delete release-drafter.yml by @coreydaley in https://github.com/gorilla/mux/pull/719
* Delete stale.yml by @coreydaley in https://github.com/gorilla/mux/pull/720
* Delete AUTHORS by @coreydaley in https://github.com/gorilla/mux/pull/721
* Update LICENSE by @coreydaley in https://github.com/gorilla/mux/pull/722
* Updated the logo in README.md by @shamkarthik in https://github.com/gorilla/mux/pull/724
* Update LICENSE by @coreydaley in https://github.com/gorilla/mux/pull/723
* Update issues.yml by @coreydaley in https://github.com/gorilla/mux/pull/726
* Update issues.yml by @coreydaley in https://github.com/gorilla/mux/pull/727
* run go fmt with Go 1.20 by @shogo82148 in https://github.com/gorilla/mux/pull/725
* Fix  `Single Page Application` example in `README.md` file by @amustaque97 in https://github.com/gorilla/mux/pull/678
* [BUG] Inconsistent HTTP status code on query mismatch by @soheilrt in https://github.com/gorilla/mux/pull/712
* Clarify documentation examples of Route methods by @andrew-werdna in https://github.com/gorilla/mux/pull/672
* changed the routeVariables text content. by @sumanpaikdev in https://github.com/gorilla/mux/pull/708
* Add GetVarNames() by @eh-steve in https://github.com/gorilla/mux/pull/676
* fix SPA handler in README.md by @sy9 in https://github.com/gorilla/mux/pull/733
* update GitHub workflows by @coreydaley in https://github.com/gorilla/mux/pull/734

## New Contributors
* @Jille made their first contribution in https://github.com/gorilla/mux/pull/602
* @michaelgrigoryan25 made their first contribution in https://github.com/gorilla/mux/pull/679
* @amustaque97 made their first contribution in https://github.com/gorilla/mux/pull/693
* @coreydaley made their first contribution in https://github.com/gorilla/mux/pull/713
* @apoorvajagtap made their first contribution in https://github.com/gorilla/mux/pull/718
* @shamkarthik made their first contribution in https://github.com/gorilla/mux/pull/724
* @shogo82148 made their first contribution in https://github.com/gorilla/mux/pull/725
* @soheilrt made their first contribution in https://github.com/gorilla/mux/pull/712
* @andrew-werdna made their first contribution in https://github.com/gorilla/mux/pull/672
* @sumanpaikdev made their first contribution in https://github.com/gorilla/mux/pull/708
* @eh-steve made their first contribution in https://github.com/gorilla/mux/pull/676
* @sy9 made their first contribution in https://github.com/gorilla/mux/pull/733

**Full Changelog**: https://github.com/gorilla/mux/compare/v1.8.0...v1.8.1

v1.8.0 ☀️ (2020-08-22)

v1.8.0 addresses a minor regression with the variable extraction when using a wildcard host match. Specifying `.Host(“foo.example.com:{port:.*})` will now correctly capture the port into `mux.Vars`.

## CHANGELOG

* fix: regression in vars extract for wildcard host (#579) @harshavardhana
* Remove stale text from comment. (#568) @EricIO

v1.7.4 (2020-02-12)

v1.7.4 addresses a number of performance improvements (#544), bugs (#509, #535), and documentation improvements.

## CHANGELOG

* Reduce allocations in (*routeRegexp).getURLQuery (#544) @klauspost
* Fixed golint warnings (#526) @KosToZyB
* fix headers regexp test case (#536) @icattlecoder
* Fix the CORSMethodMiddleware bug with subrouters (#535) @fharding1
* Remove/cleanup request context helpers (#525) @fharding1
* Guess the scheme if r.URL.Scheme is unset (#474) @euank
* Added capacity to slice creation, when capacity is known (#516) @vivekv96
* Modified http status codes, using constants provided by the http package (#514) @vivekv96
* bugfix/subrouter custom methodNotAllowed handler returning 404 (#509) (#510) @jonasdebeukelaer
* Update README (self-host logo) (#513) @elithrar
* Remove TravisCI badge (#503) @elithrar
* Add documentation for using mux to serve a SPA (#493) @fharding1
* Simplify code (#501) @muesli
* Avoid unnecessary conversion (#502) @muesli
* Update config.yml (#495) @elithrar

v1.7.3 (2019-06-30)

This is a patch release that mostly incorporates test & build system updates, as well as fixing a rare cause of panics.

## CHANGELOG

* Update stale.yml (#494) @elithrar
* Improve CORS Method Middleware (#477) @fharding1
* Delete ISSUE_TEMPLATE.md (#492) @elithrar
* Use subtests for middleware tests (#478) @fharding1
* Delete .travis.yml (#490) @elithrar
* Fix nil panic in authentication middleware example (#489) @fharding1
* [WIP] Create CircleCI config (#484) @elithrar

v1.7.2 (2019-05-17)

⚠️ This release relaxes the host:port matching when using [`*Route.Host()`](https://godoc.org/github.com/gorilla/mux#Route.Host) as introduced in [v1.7.0](https://github.com/gorilla/mux/releases/tag/v1.7.0). If a port is _not_ provided, the route will match on any port, matching behaviour for all versions of mux prior to v1.7.0.

See #447 for a fuller discussion.

## CHANGELOG

* Route.Host -matching will ignore any provided port from getHost(), if… (#447) @cognusion

v1.7.1 (2019-04-05)

No notable changes 🎆 

## CHANGELOG

* Minor spelling mistake  (#454) @souvikhaldar
* fix go1.12 go vet usage (#458) @seriousben
* adding Router.Name to create new Route (#457) @seriousben
* Remove sudo setting from travis.yml (#462) @sekky0905

🦍 v1.7.0 (2019-01-27)

## Notable changes:

* mux will only support Go 1.7 and newer: this has allowed us to remove the older `gorilla/context` code. Go 1.7 has been out since August 2016.
* [`*Route.Host()`](https://godoc.org/github.com/gorilla/mux#Route.Host) matching now includes the `host:port`, as opposed to just the `host`.
* Subrouters should correctly return a 405 if the route matches but the method does not (see #437 for details)

## CHANGELOG

* [deps] Add go.mod for versioned Go (#376) @elithrar
* Initialize user map (#371) @kalafut
* Update LICENSE & AUTHORS files. (#386) @elithrar
* Add 1.11 to build in travis (#398) @yershalom
* Drop support for Go < 1.7: remove gorilla/context (#391) @fharding1
* Create release-drafter.yml (#399) @elithrar
* Always run on the latest stable Go version. (#402) @elithrar
* Use constant for 301 status code in regexp.go (#412) @trungnn
* Use subtests in mux_test.go (#415) @kanozec
* Add stalebot config (#424) @elithrar
* Update and rename stale to stale.yml (#425) @elithrar
* remove redundant code that remove support gorilla/context (#427) @alimy
* Replace domain.com with example.com (#434) @raeesbhatti
* fix #2, return full host:port info from getHost (#383) @santsai
* Ignore ErrNotFound while matching Subrouters (#438) @g-w
* Call WriteHeader after setting other header(s) in the example (#442) @timucingelici
* replace rr.HeaderMap by rr.Header() (#443) @moeryomenko

v1.6.2 ⚡️ (2018-05-13)

Adds the [`CORSMethodMiddleware`](https://godoc.org/github.com/gorilla/mux#CORSMethodMiddleware) middleware, which allows package users to automatically generate a `Access-Control-Allow-Methods` HTTP response header based on which methods are configured for a given route. This is useful when dealing with cross-origin requests, and can be easily enabled via `router.Use(mux.CORSMethodMiddleware)`.

This release otherwise includes documentation fixes and improvements. We are always looking to improve the documentation for mux, and contributions are welcome!

CHANGELOG
e3702be [docs] Improve docstrings for middleware, skipclean (#375)
fdeb7bc [docs] Doc fix for testing variables in path (#374)
5e55a4a Add CORSMethodMiddleware (#366)
ded0c29 Fix linter issues (docs) (#370)
b57cb16 [build] Update Go versions; add 1.10.x (#364)
94231ff Fix table-driven example documentation (#363)
4dbd923 Make Use() variadic (#355)
07ba1fd Modify http status code to variable in README (#350)
d284fd8 Modify 403 status code to const variable (#349)

First Class Middleware Support (2018-01-16)

gorilla/mux now provides first-class support for "middleware" thanks to @roobre! Middleware are handlers that can intercept request & response processing *after a route match*, but before/after other handlers are invoked. See the documentation for the full details: https://github.com/gorilla/mux#middleware

Previously, developers would have to use a thin wrapper to achieve this per-application. Requests for this functionality built up enough over time such that we've added it to mux's built-in methods.

CHANGELOG: 

53c1911 [feat] Add middleware support as discussed in #293 (#294)
5bbbb5b [docs] Add graceful shutdown example (#329)
512169e refactor routeRegexp, particularily newRouteRegexp. (#328)
5ab525f Public test API to set URL params (#322)
7904d2e [docs] Add example usage for Route.HeadersRegexp (#320)
c572efe [docs] Note StrictSlash re-direct behaviour #308 (#321)
65ec724 Create ISSUE_TEMPLATE.md (#318)
4a3d4f3 [bugfix] Fix method subrouter handler matching (#300) (#317)
2d5fef0 [docs] fix outdated UseEncodedPath method docs (#314)

v1.6.0 (2017-11-07)

v1.6.0 major changes:

* `RouteMatch.MatchErr` is now set to `ErrNotFound` when the route does not match.
* Go 1.5.x and below are no longer supported
* New methods for fetching the query template have been added in [`Route.GetQueriesRegexp`](https://godoc.org/github.com/gorilla/mux#Route.GetQueriesRegexp) and [`Route.GetQueriesTemplates`](https://godoc.org/github.com/gorilla/mux#Route.GetQueriesTemplates)
* Bug fixes and documentation updates, detailed below.

CHANGELOG
7f08801 MatchErr is set to ErrNotFound if NotFoundHandler is used (#311)
9f48112 [docs] Document router.Match (#313)
bc452d9 [build] Allow tip failures (#312)
7625a85 .travis.yml: Remove versions < go1.5 from build matrix
c9183aa use req.URL.EscapedPath() instead of getPath(req) (#306)
10490f5 GetQueryTemplates and GetQueryRegexp extraction (#304)
9bd9ff2 Added 1.9 build step (#303)
bdd5a5a Fix WriteHeader in TestA301ResponseWriter. (#301)
3f19343 [docs] Document evaluation order for routes (#297)

v1.5.0 (2017-09-12)

v1.5.0 major changes:

* A HTTP 405 "Method Not Allowed" will be returned when the method does not match for the route. This is a change from existing behaviour, where a 404 is returned instead. This behaviour, and the error message, can be customized by setting the [`MethodNotAllowed`](https://godoc.org/github.com/gorilla/mux#Router) property of a `*Router` instance.
* [`Walk`](https://godoc.org/github.com/gorilla/mux#Router.Walk) will now walk all attached sub-routers


CHANGELOG

24fca30 [docs] README.md: add missing `.` (#292)
bb285ea [docs] Fix missing space in docstring (#289)
a659b61 Fix #271:  Return 405 instead of 404 when request method doesn't match the route
ac112f7 Prefer scheme on child route when building URLs.
37b3a6c Use scheme from parent router when building URLs.
8c683ee Fix typo
18fca31 Add test and fix for escaped query values.
c7a138d Update docs.
f9aa23a Add tests for support for queries in URL reversing.
9c9af15 Add support for queries in URL reversing.
043ee65 Update Walking Routes Section
59ce668 Fix invalid example code
85b8c20 Removing half of conflict marker (#268)
456bcfa Update README with example for Router.Walk
4d814f7 Update ancestors parameter for WalkFunc for matcher subrouters
a322b2c Update Walk to match all subrouters

v1.4.0 (2017-05-21)

bcd8bc7 Support building URLs with non-http schemes. (#260)
b552615 Added method Route.GetMethods
1856953 Added method Route.GetPathRegexp
599cba5 Fixing Regexp in the benchmark test (#234)
ad4ce0e updating logic in route matcher, cleaner and saner (#235)

v1.3.0 (2017-01-18)

Summary
- Capture groups in regular expressions - e.g. `(pattern|thing)` vs `(?:pattern|thing)` are have not been supported. We now fail fast (panic on startup) if we detect any routes with a capturing group. See https://github.com/gorilla/mux/issues/200 for discussion.

CHANGELOG

392c28f [bugfix] fail fast if regex is incorrectly specified using capturing groups. (#218)
cafdb65 [docs] Add route listing example to README

v1.2.0 (2017-01-17)

Summary:
- `PathPrefix` now supports defining an index path by calling `PathPrefix("/foo")` and defining a route as `/`
- Documented the regex support - capture groups should not be provided.
- Fix encoded path & variable extraction bugs.

CHANGELOG:

b128961 Merge pull request #199 from wirehead/minor-doc-tweek
34dda71 Merge pull request #215 from ShaneSaww/fix_for_subroutes_with_pathPrefix
b9ff34f Adding some extra tests, to hit all the use cases
293ebe1 Adding in a check for routes with just /
910dd3a Remove unnecessary line from example
239e05f Clarify how route variables work. (#151)
757bef9 Merge pull request #196 from olt/doc-non-capture-groups
14f5df0 document non-capturing groups (closes #143)
0a192a1 Add useEncodedPath option to router and routes (#190)
0b13a92 Simplify extractVars, fixes edge cases. (#185)

v1.1 "Long Overdue" (2016-03-26)

We're now tagging releases with SemVer, something that was long overdue. gorilla/mux has strict API compatibility guarantees, excepting any security issues, but we understand that being able to vendor specific versions is a useful feature.

Minor breaking changes (i.e. regex functionality) will be treated as minor releases.

We also strongly recommend that you stay up to date: although this project has not had any security issues to date, back-porting security patches across multiple releases (v1.1.1, v1.2.1, etc.) is not maintianable for us.