Commit graph

71 commits

Author SHA1 Message Date
Eduardo Sachser
423901dfd5
Fixing RegisterMethod method value generation (#573)
* Fix: RegisterMethod registering first method with same value as mTRACE

* Len of methods must not be greater than IntSize - 2
2021-02-05 20:28:56 -05:00
Masaya Watanabe
681ea79f56
Fix: validate empty path param (#567)
Thanks @matsuyoshi30
2020-12-24 12:28:05 -05:00
alresvor
3950456604
remove unnecessary type conversions (#523)
name                              old time/op    new time/op
Mux/route:/sup/123/foo/this-8     1.24µs ± 0%    1.99µs ± 0%

name                              old alloc/op   new alloc/op
Mux/route:/sup/123/foo/this-8     456B ± 0%      448B ± 0%

name                              old allocs/op  new allocs/op
Mux/route:/sup/123/foo/this-8     4.00 ± 0%      3.00 ± 0%
2020-06-26 10:06:54 -04:00
Casey Hadden
5704d7ee98
fix: handle methodnotallowed with path variables (#512) 2020-05-22 09:51:03 -04:00
Joakim Hamrén
99ad97ff6f
Route recursive-search regexp patterns (#506) 2020-04-16 08:10:37 -04:00
Peter Kieltyka
b612eb4a06 Comments 2020-02-19 22:26:21 -05:00
Peter Kieltyka
17fb1065d2 walk method will hide /*/ internal detail when generating route list 2020-01-10 19:23:42 -05:00
Peter Kieltyka
3658d98ee4 fix regexp routing to include default value when param is not matched 2020-01-08 21:55:02 -05:00
Christian Muehlhaeuser
ece538c84e Simplify code
- Removed unnecessary conversions
- 0 is the default capacity, no need to specify it
2019-08-06 21:13:43 -04:00
Christian Muehlhaeuser
b83ac995c3 Simplify code
- We can access the pointer members directly
- Easier to read concatenation
2019-08-06 21:12:21 -04:00
tkivisik
120ad4a206 documented Handlers map key 2019-08-06 21:09:28 -04:00
Peter Kieltyka
85905ae4dd fixes a regression for wildcard param checking 2019-02-24 11:35:16 -05:00
Peter Kieltyka
cd12532e98 fixes #333, which adds additional check to ensure wildcard is used at end of a url pattern 2019-01-09 09:32:43 -05:00
Peter Kieltyka
0ebf7795c5 fix travis for go 1.7 and go 1.8 2018-10-24 06:12:33 -04:00
Peter Kieltyka
be3aea5558 revert methodMap change - brings back support for go 1.7 and 1.8 2018-10-24 06:06:09 -04:00
Rodney
daa22f628c Exported HTTP method names to avoid manual entry (#353)
* Using package http's already defined Method constants instead of redefining them
2018-10-23 11:52:23 -04:00
Peter Kieltyka
575dd3a137 Fix #277 by setting param values for empty segments 2017-11-20 07:10:20 -08:00
Peter Kieltyka
1cbc3a2b40 Fix lint warnings 2017-11-08 17:29:18 -05:00
Peter Kieltyka
d806569952 New chi.RegisterMethod(method) to add support for custom HTTP methods (#271) 2017-10-10 17:28:23 -04:00
Domen Ipavec
624e6e12e9 Fix: regex matching only part of parameter (#258)
* Add start and end to param regex

* Added test for regex match whole param
2017-09-07 09:24:55 -07:00
Peter Kieltyka
d132b31857 middleware.GetHead (#248)
Add Match(..) bool to chi.Routes, and add middleware.GetHead to automatically route missing head requests to GET handlers

* Put chi.Routes pointer on the route Context instead of having to pass to the middleware

* Rename FindHandler to Find, and add breaking test when searching subtrees

* Rename middleware to GetHead, and update Mux#Find method to search subroutes

* Update README, router at ~1000 LOC

* Redefine Routes#Find(..) http.Handler to Routes#Match(..) bool

* Update benchmarks

* Slightly adjust GetHead middleware to make it clearer
2017-08-31 21:51:08 -04:00
Peter Kieltyka
ba73ba0623 FindRoute now returns specific method handler along with endpoints map 2017-08-22 13:58:43 -04:00
Nic Pottier
df0b91fada Add support for using {} in regex paths (#245) 2017-08-17 12:09:07 -04:00
Peter Kieltyka
25354a53cc go vet and golint the project, release 3.1.5 2017-08-02 17:27:05 -04:00
Vojtech Vitek
524a020446 Implement router tree Walker, an analogy to filepath.Walk (#222)
* Implement router tree Walker, an analogy to filepath.Walk

func Walk(r Routes, walkFn WalkFunc) error
type WalkFunc func(method string, route string, handler http.Handler, middlewares ...func(http.Handler) http.Handler) error

* Move Walker to tree.go
2017-07-25 13:24:32 -04:00
Peter Kieltyka
7e6b856011 Flatten Context.URLParams data structure 2017-07-24 16:38:22 -04:00
Peter Kieltyka
a40fe4fc12 Add test case for mux mounts 2017-07-21 10:22:23 -04:00
Peter Kieltyka
49e7138cab organize routing patterns as endpoints with pattern, handler, paramKeys in the leaf nodes 2017-07-09 19:17:12 -04:00
Peter Kieltyka
25201e8a88 Export access to Context.URLParams 2017-07-08 18:12:46 -04:00
Peter Kieltyka
45f7a16ad6 Continue searching for route on empty param value case 2017-07-08 16:45:31 -04:00
Peter Kieltyka
3a7936b243 short-circuit and return no matching route for empty param values (#224) 2017-07-08 14:31:51 -04:00
Niklas Janlert
4cbb5e2f2a Avoid matching parameters across path segments (#216)
Fixes #215
2017-06-28 10:30:38 -04:00
Peter Kieltyka
34b58319a8 Add support for LINK/UNLINK http methods, via Method() 2017-06-21 11:37:04 -04:00
Peter Kieltyka
02e6bbdfd1 v3.0.0 release 2017-06-21 10:43:59 -04:00
Peter Kieltyka
8f717baab4 v3 beta 1 2017-06-21 10:43:59 -04:00
Peter Kieltyka
c8430c73ce Improve tree findPattern() 2016-11-22 20:34:40 -05:00
Peter Kieltyka
3697c6e809 Remove debug code 2016-11-22 20:30:34 -05:00
Peter Kieltyka
96dad7e790 Fix #115 2016-11-22 20:28:55 -05:00
Jose Carlos Ustra Junior
1c72bb6879 Resolve golint issues that are not related to comments 2016-09-22 13:54:14 -03:00
Peter Kieltyka
a98068174b Remove Any() method from Router 2016-08-19 15:33:27 -04:00
Peter Kieltyka
49861275db Builder first version complete 2016-08-19 15:25:00 -04:00
Peter Kieltyka
4918cd6076 Docgen is almost complete, generated huge docs of pressly/api 2016-08-18 17:58:15 -07:00
Peter Kieltyka
61be033f8e Change inline chain handlers to support doc generation 2016-08-17 16:52:04 -07:00
Peter Kieltyka
500b815b02 Automatic doc generation from Router 2016-08-17 16:52:04 -07:00
Peter Kieltyka
6ca1005b79 Fix context value chaining 2016-08-17 16:16:12 -07:00
Peter Kieltyka
2e47040c63 Runtime checks for routing edge cases 2016-08-04 16:14:33 -04:00
Peter Kieltyka
bade339a43 Record routing pattern when building the tree, faster for routing 2016-07-22 13:59:27 -04:00
Peter Kieltyka
34af882aa1 Record routing patterns throughout a request lifecycle 2016-07-22 11:34:02 -04:00
Peter Kieltyka
e10a47f9d4 Refinements 2016-07-21 22:30:07 -04:00
Peter Kieltyka
853f9c7806 Flatten tree, node and edges structures 2016-07-15 15:51:30 -04:00