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.

CHANGELOG.md 14KB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. # Changelog
  2. ## v1.5.4 (2021-02-27)
  3. - Undo prior retraction in v1.5.3 as we prepare for v5.0.0 release
  4. - History of changes: see https://github.com/go-chi/chi/compare/v1.5.3...v1.5.4
  5. ## v1.5.3 (2021-02-21)
  6. - Update go.mod to go 1.16 with new retract directive marking all versions without prior go.mod support
  7. - History of changes: see https://github.com/go-chi/chi/compare/v1.5.2...v1.5.3
  8. ## v1.5.2 (2021-02-10)
  9. - Reverting allocation optimization as a precaution as go test -race fails.
  10. - Minor improvements, see history below
  11. - History of changes: see https://github.com/go-chi/chi/compare/v1.5.1...v1.5.2
  12. ## v1.5.1 (2020-12-06)
  13. - Performance improvement: removing 1 allocation by foregoing context.WithValue, thank you @bouk for
  14. your contribution (https://github.com/go-chi/chi/pull/555). Note: new benchmarks posted in README.
  15. - `middleware.CleanPath`: new middleware that clean's request path of double slashes
  16. - deprecate & remove `chi.ServerBaseContext` in favour of stdlib `http.Server#BaseContext`
  17. - plus other tiny improvements, see full commit history below
  18. - History of changes: see https://github.com/go-chi/chi/compare/v4.1.2...v1.5.1
  19. ## v1.5.0 (2020-11-12) - now with go.mod support
  20. `chi` dates back to 2016 with it's original implementation as one of the first routers to adopt the newly introduced
  21. context.Context api to the stdlib -- set out to design a router that is faster, more modular and simpler than anything
  22. else out there -- while not introducing any custom handler types or dependencies. Today, `chi` still has zero dependencies,
  23. and in many ways is future proofed from changes, given it's minimal nature. Between versions, chi's iterations have been very
  24. incremental, with the architecture and api being the same today as it was originally designed in 2016. For this reason it
  25. makes chi a pretty easy project to maintain, as well thanks to the many amazing community contributions over the years
  26. to who all help make chi better (total of 86 contributors to date -- thanks all!).
  27. Chi has been an labour of love, art and engineering, with the goals to offer beautiful ergonomics, flexibility, performance
  28. and simplicity when building HTTP services with Go. I've strived to keep the router very minimal in surface area / code size,
  29. and always improving the code wherever possible -- and as of today the `chi` package is just 1082 lines of code (not counting
  30. middlewares, which are all optional). As well, I don't have the exact metrics, but from my analysis and email exchanges from
  31. companies and developers, chi is used by thousands of projects around the world -- thank you all as there is no better form of
  32. joy for me than to have art I had started be helpful and enjoyed by others. And of course I use chi in all of my own projects too :)
  33. For me, the asthetics of chi's code and usage are very important. With the introduction of Go's module support
  34. (which I'm a big fan of), chi's past versioning scheme choice to v2, v3 and v4 would mean I'd require the import path
  35. of "github.com/go-chi/chi/v4", leading to the lengthy discussion at https://github.com/go-chi/chi/issues/462.
  36. Haha, to some, you may be scratching your head why I've spent > 1 year stalling to adopt "/vXX" convention in the import
  37. path -- which isn't horrible in general -- but for chi, I'm unable to accept it as I strive for perfection in it's API design,
  38. aesthetics and simplicity. It just doesn't feel good to me given chi's simple nature -- I do not foresee a "v5" or "v6",
  39. and upgrading between versions in the future will also be just incremental.
  40. I do understand versioning is a part of the API design as well, which is why the solution for a while has been to "do nothing",
  41. as Go supports both old and new import paths with/out go.mod. However, now that Go module support has had time to iron out kinks and
  42. is adopted everywhere, it's time for chi to get with the times. Luckily, I've discovered a path forward that will make me happy,
  43. while also not breaking anyone's app who adopted a prior versioning from tags in v2/v3/v4. I've made an experimental release of
  44. v1.5.0 with go.mod silently, and tested it with new and old projects, to ensure the developer experience is preserved, and it's
  45. largely unnoticed. Fortunately, Go's toolchain will check the tags of a repo and consider the "latest" tag the one with go.mod.
  46. However, you can still request a specific older tag such as v4.1.2, and everything will "just work". But new users can just
  47. `go get github.com/go-chi/chi` or `go get github.com/go-chi/chi@latest` and they will get the latest version which contains
  48. go.mod support, which is v1.5.0+. `chi` will not change very much over the years, just like it hasn't changed much from 4 years ago.
  49. Therefore, we will stay on v1.x from here on, starting from v1.5.0. Any breaking changes will bump a "minor" release and
  50. backwards-compatible improvements/fixes will bump a "tiny" release.
  51. For existing projects who want to upgrade to the latest go.mod version, run: `go get -u github.com/go-chi/chi@v1.5.0`,
  52. which will get you on the go.mod version line (as Go's mod cache may still remember v4.x). Brand new systems can run
  53. `go get -u github.com/go-chi/chi` or `go get -u github.com/go-chi/chi@latest` to install chi, which will install v1.5.0+
  54. built with go.mod support.
  55. My apologies to the developers who will disagree with the decisions above, but, hope you'll try it and see it's a very
  56. minor request which is backwards compatible and won't break your existing installations.
  57. Cheers all, happy coding!
  58. ---
  59. ## v4.1.2 (2020-06-02)
  60. - fix that handles MethodNotAllowed with path variables, thank you @caseyhadden for your contribution
  61. - fix to replace nested wildcards correctly in RoutePattern, thank you @@unmultimedio for your contribution
  62. - History of changes: see https://github.com/go-chi/chi/compare/v4.1.1...v4.1.2
  63. ## v4.1.1 (2020-04-16)
  64. - fix for issue https://github.com/go-chi/chi/issues/411 which allows for overlapping regexp
  65. route to the correct handler through a recursive tree search, thanks to @Jahaja for the PR/fix!
  66. - new middleware.RouteHeaders as a simple router for request headers with wildcard support
  67. - History of changes: see https://github.com/go-chi/chi/compare/v4.1.0...v4.1.1
  68. ## v4.1.0 (2020-04-1)
  69. - middleware.LogEntry: Write method on interface now passes the response header
  70. and an extra interface type useful for custom logger implementations.
  71. - middleware.WrapResponseWriter: minor fix
  72. - middleware.Recoverer: a bit prettier
  73. - History of changes: see https://github.com/go-chi/chi/compare/v4.0.4...v4.1.0
  74. ## v4.0.4 (2020-03-24)
  75. - middleware.Recoverer: new pretty stack trace printing (https://github.com/go-chi/chi/pull/496)
  76. - a few minor improvements and fixes
  77. - History of changes: see https://github.com/go-chi/chi/compare/v4.0.3...v4.0.4
  78. ## v4.0.3 (2020-01-09)
  79. - core: fix regexp routing to include default value when param is not matched
  80. - middleware: rewrite of middleware.Compress
  81. - middleware: suppress http.ErrAbortHandler in middleware.Recoverer
  82. - History of changes: see https://github.com/go-chi/chi/compare/v4.0.2...v4.0.3
  83. ## v4.0.2 (2019-02-26)
  84. - Minor fixes
  85. - History of changes: see https://github.com/go-chi/chi/compare/v4.0.1...v4.0.2
  86. ## v4.0.1 (2019-01-21)
  87. - Fixes issue with compress middleware: #382 #385
  88. - History of changes: see https://github.com/go-chi/chi/compare/v4.0.0...v4.0.1
  89. ## v4.0.0 (2019-01-10)
  90. - chi v4 requires Go 1.10.3+ (or Go 1.9.7+) - we have deprecated support for Go 1.7 and 1.8
  91. - router: respond with 404 on router with no routes (#362)
  92. - router: additional check to ensure wildcard is at the end of a url pattern (#333)
  93. - middleware: deprecate use of http.CloseNotifier (#347)
  94. - middleware: fix RedirectSlashes to include query params on redirect (#334)
  95. - History of changes: see https://github.com/go-chi/chi/compare/v3.3.4...v4.0.0
  96. ## v3.3.4 (2019-01-07)
  97. - Minor middleware improvements. No changes to core library/router. Moving v3 into its
  98. - own branch as a version of chi for Go 1.7, 1.8, 1.9, 1.10, 1.11
  99. - History of changes: see https://github.com/go-chi/chi/compare/v3.3.3...v3.3.4
  100. ## v3.3.3 (2018-08-27)
  101. - Minor release
  102. - See https://github.com/go-chi/chi/compare/v3.3.2...v3.3.3
  103. ## v3.3.2 (2017-12-22)
  104. - Support to route trailing slashes on mounted sub-routers (#281)
  105. - middleware: new `ContentCharset` to check matching charsets. Thank you
  106. @csucu for your community contribution!
  107. ## v3.3.1 (2017-11-20)
  108. - middleware: new `AllowContentType` handler for explicit whitelist of accepted request Content-Types
  109. - middleware: new `SetHeader` handler for short-hand middleware to set a response header key/value
  110. - Minor bug fixes
  111. ## v3.3.0 (2017-10-10)
  112. - New chi.RegisterMethod(method) to add support for custom HTTP methods, see _examples/custom-method for usage
  113. - Deprecated LINK and UNLINK methods from the default list, please use `chi.RegisterMethod("LINK")` and `chi.RegisterMethod("UNLINK")` in an `init()` function
  114. ## v3.2.1 (2017-08-31)
  115. - Add new `Match(rctx *Context, method, path string) bool` method to `Routes` interface
  116. and `Mux`. Match searches the mux's routing tree for a handler that matches the method/path
  117. - Add new `RouteMethod` to `*Context`
  118. - Add new `Routes` pointer to `*Context`
  119. - Add new `middleware.GetHead` to route missing HEAD requests to GET handler
  120. - Updated benchmarks (see README)
  121. ## v3.1.5 (2017-08-02)
  122. - Setup golint and go vet for the project
  123. - As per golint, we've redefined `func ServerBaseContext(h http.Handler, baseCtx context.Context) http.Handler`
  124. to `func ServerBaseContext(baseCtx context.Context, h http.Handler) http.Handler`
  125. ## v3.1.0 (2017-07-10)
  126. - Fix a few minor issues after v3 release
  127. - Move `docgen` sub-pkg to https://github.com/go-chi/docgen
  128. - Move `render` sub-pkg to https://github.com/go-chi/render
  129. - Add new `URLFormat` handler to chi/middleware sub-pkg to make working with url mime
  130. suffixes easier, ie. parsing `/articles/1.json` and `/articles/1.xml`. See comments in
  131. https://github.com/go-chi/chi/blob/master/middleware/url_format.go for example usage.
  132. ## v3.0.0 (2017-06-21)
  133. - Major update to chi library with many exciting updates, but also some *breaking changes*
  134. - URL parameter syntax changed from `/:id` to `/{id}` for even more flexible routing, such as
  135. `/articles/{month}-{day}-{year}-{slug}`, `/articles/{id}`, and `/articles/{id}.{ext}` on the
  136. same router
  137. - Support for regexp for routing patterns, in the form of `/{paramKey:regExp}` for example:
  138. `r.Get("/articles/{name:[a-z]+}", h)` and `chi.URLParam(r, "name")`
  139. - Add `Method` and `MethodFunc` to `chi.Router` to allow routing definitions such as
  140. `r.Method("GET", "/", h)` which provides a cleaner interface for custom handlers like
  141. in `_examples/custom-handler`
  142. - Deprecating `mux#FileServer` helper function. Instead, we encourage users to create their
  143. own using file handler with the stdlib, see `_examples/fileserver` for an example
  144. - Add support for LINK/UNLINK http methods via `r.Method()` and `r.MethodFunc()`
  145. - Moved the chi project to its own organization, to allow chi-related community packages to
  146. be easily discovered and supported, at: https://github.com/go-chi
  147. - *NOTE:* please update your import paths to `"github.com/go-chi/chi"`
  148. - *NOTE:* chi v2 is still available at https://github.com/go-chi/chi/tree/v2
  149. ## v2.1.0 (2017-03-30)
  150. - Minor improvements and update to the chi core library
  151. - Introduced a brand new `chi/render` sub-package to complete the story of building
  152. APIs to offer a pattern for managing well-defined request / response payloads. Please
  153. check out the updated `_examples/rest` example for how it works.
  154. - Added `MethodNotAllowed(h http.HandlerFunc)` to chi.Router interface
  155. ## v2.0.0 (2017-01-06)
  156. - After many months of v2 being in an RC state with many companies and users running it in
  157. production, the inclusion of some improvements to the middlewares, we are very pleased to
  158. announce v2.0.0 of chi.
  159. ## v2.0.0-rc1 (2016-07-26)
  160. - Huge update! chi v2 is a large refactor targetting Go 1.7+. As of Go 1.7, the popular
  161. community `"net/context"` package has been included in the standard library as `"context"` and
  162. utilized by `"net/http"` and `http.Request` to managing deadlines, cancelation signals and other
  163. request-scoped values. We're very excited about the new context addition and are proud to
  164. introduce chi v2, a minimal and powerful routing package for building large HTTP services,
  165. with zero external dependencies. Chi focuses on idiomatic design and encourages the use of
  166. stdlib HTTP handlers and middlwares.
  167. - chi v2 deprecates its `chi.Handler` interface and requires `http.Handler` or `http.HandlerFunc`
  168. - chi v2 stores URL routing parameters and patterns in the standard request context: `r.Context()`
  169. - chi v2 lower-level routing context is accessible by `chi.RouteContext(r.Context()) *chi.Context`,
  170. which provides direct access to URL routing parameters, the routing path and the matching
  171. routing patterns.
  172. - Users upgrading from chi v1 to v2, need to:
  173. 1. Update the old chi.Handler signature, `func(ctx context.Context, w http.ResponseWriter, r *http.Request)` to
  174. the standard http.Handler: `func(w http.ResponseWriter, r *http.Request)`
  175. 2. Use `chi.URLParam(r *http.Request, paramKey string) string`
  176. or `URLParamFromCtx(ctx context.Context, paramKey string) string` to access a url parameter value
  177. ## v1.0.0 (2016-07-01)
  178. - Released chi v1 stable https://github.com/go-chi/chi/tree/v1.0.0 for Go 1.6 and older.
  179. ## v0.9.0 (2016-03-31)
  180. - Reuse context objects via sync.Pool for zero-allocation routing [#33](https://github.com/go-chi/chi/pull/33)
  181. - BREAKING NOTE: due to subtle API changes, previously `chi.URLParams(ctx)["id"]` used to access url parameters
  182. has changed to: `chi.URLParam(ctx, "id")`