Commit Graph

60 Commits

Author SHA1 Message Date
Chris Hines
bcd8bc72b0 Support building URLs with non-http schemes. (#260)
* Move misplaced tests and fix comments.

* Support building URLs with non-http schemes.

- Capture first scheme configured for a route for use when building
  URLs.
- Add new Route.URLScheme method similar to URLHost and URLPath.
- Update Route.URLHost and Route.URL to use the captured scheme if
  present.

* Remove Route.URLScheme method.

* Remove UTF-8 BOM.
2017-05-20 21:50:13 -07:00
Bulat Gaifullin
b552615e22 Added method Route.GetMethods 2017-05-20 15:55:46 -07:00
Bulat Gaifullin
1856953e53 Added method Route.GetPathRegexp 2017-05-20 15:55:46 -07:00
Carlos Alexandro Becker
4c1c3952b7 fixed typo (#250) 2017-04-26 21:12:50 -07:00
Adam Eijdenberg
392c28fe23 [bugfix] fail fast if regex is incorrectly specified using capturing groups. (#218) 2017-01-18 05:43:44 -08:00
ShaneSaww
b9ff34f617 Adding some extra tests, to hit all the use cases 2017-01-16 21:11:35 -08:00
ShaneSaww
293ebe1493 Adding in a check for routes with just / 2017-01-15 21:47:00 -08:00
Kush Mansingh
0a192a1931 Add useEncodedPath option to router and routes (#190)
- Resolves a breaking change in #184
2016-09-02 08:33:43 -07:00
Richard Musiol
0b13a92220 Simplify extractVars, fixes edge cases. (#185)
Also make sure all regexp groups in tests are non-capturing.
2016-08-27 09:50:34 -07:00
Aaron Taylor
34bf6dc9fa make the getPath method safer, fixing panics within App Engine (#189) 2016-08-24 16:34:02 -07:00
Kush Mansingh
674ef1c280 Add mechanism to route based on the escaped path (#184)
* Add mechanism to route based on the escaped path, correct request mocking in tests

* Remove unneccessary regex matching, substitute with string slicing

* Add test case and handling for requests with no host/scheme
2016-08-24 06:45:17 -07:00
Kamil Kisiel
327d4b684c Clean up some naming in mux_test.go 2016-07-30 16:45:59 -07:00
Martin Hamrle
cf57124f1d Fix error handling in Router.Walk
In old version error was not returned properly, In one walkFn call
error was checked only for SkipRouter but not for nil.
2016-07-25 18:05:24 +02:00
Eric J. Holmes
fdfca9f917 Support native context.Context when go1.7 is used. 2016-06-04 15:38:01 +07:00
Matt Silverlock
9c19ed558d [feature] Add SkipClean option
- SkipClean skips cleaning routes (or a route) - e.g. when true, if the route path is "/path//to", it will remain with the double slash. This is helpful if you have a route like: /fetch/http://xkcd.com/534/
2016-05-02 10:56:24 -07:00
Jingwen Owen Ou
9935257381 Add test for SkipClean 2016-05-02 10:24:18 -07:00
JP Robinson
65c2651643 fixing regexp changes from PR #144 2016-03-07 16:38:03 -05:00
Dj Gilcrease
f84ab9ab62 Fix go fmt issues 2016-02-28 14:46:18 -08:00
Dj Gilcrease
0d60c4bfeb Add tests for GetPathTemplate. Added GetHostTemplate and associated tests as well 2016-02-28 14:42:09 -08:00
Nate Woods
82a9c170d4 Covering change with unit test
This test focuses on the feature of allowing sub-routers error handlers to precede the parents, rather than the code change required to provide this functionality.
2015-12-26 00:09:25 -07:00
mitsuteru sawa
a90bbbc6fa Correct a printf verb type
% go vet
mux_test.go:1080: arg len(ancestors) for printf verb %s of wrong type:
int
2015-11-07 21:34:30 +09:00
Kamil Kisiel
5112c33f3a slightly improve printing of regexps in failed tests. 2015-08-11 22:16:39 -07:00
Shinya Kawaguchi
577b9e4a65 Add tests for hyphenated variable names 2015-08-11 04:05:30 +09:00
Kamil Kisiel
8965bfef36 Merge branch 'subexp-fix' 2015-08-07 13:34:10 -07:00
Kamil Kisiel
c3c5f0000f Add test which used to fail for queries.
Fixes #66
2015-08-06 22:12:38 -07:00
Kamil Kisiel
e73f183699 fix use of capturing subexpressions in pattern matches.
The router now associates a regexp named group with each mux variable.
It only fills variables when capturing group name match instead of
relying on indices, which doesn't work if a variable regexp has interior
capturing groups.

Fixes #62
2015-08-06 20:32:43 -07:00
Kamil Kisiel
f15e0c4946 Merge pull request #100 from eastwood/master
Issue #16: Added regex support for matching headers
2015-07-27 09:40:50 -07:00
Kamil Kisiel
61445102e8 Merge pull request #111 from burrbd/master
Issue #109
2015-07-17 08:02:10 -07:00
Bay Dodd
3339267a85 adding tests 2015-07-17 10:52:37 +01:00
Bay Dodd
fe40f0d056 updating query match string 2015-07-17 10:19:25 +01:00
Kamil Kisiel
104068abd5 Merge pull request #106 from Digitalxero/router-walk-adjustments
Update the walk method  …
2015-07-16 10:39:48 -07:00
Bay Dodd
19f0a91c4e adding test and updating condition 2015-07-16 12:48:02 +01:00
Bay Dodd
2b32409792 fix for empty query 2015-07-16 10:52:01 +01:00
Dj Gilcrease
92ae1d6726 Update the walk method to walk matchers so it walks the full list of routers and child routers 2015-07-09 11:46:53 -07:00
Kamil Kisiel
9cb89f07ca Add a couple of additional tests for query strings. 2015-07-05 16:02:00 -07:00
Bay Dodd
a710a8bfa9 adding ^ and $ to query pattern 2015-07-05 12:49:02 +01:00
Craig Jellick
c0a5cbce5a Fix typo
Issue #16: Added regex support for matching headers

Issue #16 : Addressed code review and refactored support for regex into
a separate function

Added compiled regex to route matcher
2015-07-05 20:15:55 +10:00
Philippe Lafoucrière
e98fd88cbd Add complementary test for patterns with pipe 2015-03-10 21:48:38 -04:00
Philippe Lafoucrière
00bf0e01a1 Add tests for patterns with pipe
closes #62
2015-03-10 21:38:35 -04:00
Kamil Kisiel
8a875a034c Merge pull request #52 from sqs/BuildVarsFunc
BuildVarsFunc: modify route variables before building the URL from a route
2015-02-13 11:22:55 -08:00
Raphael Simon
69237eaae5 Fix "Queries" matcher to support out-of-order query string parameters 2014-05-27 09:34:08 -07:00
Raphael Simon
0a0d6a1b2a Add tests for regexp variables in query strings
Fix how regular expression gets built for query string so that order of parameters is always preserved
2014-05-26 20:20:14 -07:00
Raphael Simon
65cc9b5df8 Add ability to capture variables in query strings 2014-05-26 15:01:42 -07:00
Quinn Slack
a883d5a9b9 Call parent BuildVarsFuncs 2014-04-23 11:44:16 -07:00
Quinn Slack
cef3b0cd6d Add BuildVarsFunc to allow modifying route variables before generating a route's URL 2014-04-23 11:44:16 -07:00
Thomas ten Cate
b864f07c53 Propagate StrictSlash to subrouters instead of rudely turning it off 2014-04-23 19:53:35 +02:00
Thomas ten Cate
3509745ae8 Add tests for all four StrictSlash cases 2014-04-23 19:27:53 +02:00
Thomas ten Cate
bac1372129 Convert TestStrictSlash to a table driven test 2014-04-23 19:24:12 +02:00
Thomas ten Cate
033224c12e Document behaviour of StrictSlash and PathPrefix better, and add tests to nail this down 2014-04-23 18:19:14 +02:00
Thomas ten Cate
525eff436e Improve docs about leading and trailing slashes 2014-04-23 17:40:15 +02:00