c68d7b324a
A test for Sub-path functionality.
2023-08-11 18:42:46 +04:00
3cb32c5ec9
Sub-path implemented, now you can make a sub for a section using Router's Sub(root) method and then write only what this section contains. Like s := Sub("/api/v1") and then s.Handler("/").
2023-08-11 18:42:28 +04:00
0717a2e3d3
In case a path continues, but no child was found then break out of main for loop.
...
It was a bug that when there are children in the next node, but no parameterised one, having a non-existent path element caused the main loop to continue and firing an if pathLen == i+1 case like if there was a legit node found.
2023-08-11 18:36:13 +04:00
e25a8a42c3
A year and copyright holders weren't filled in a LICENSE, LOL.
2023-07-23 23:27:49 +04:00
bc11a46806
Added a test for paths.
2023-07-23 23:26:35 +04:00
33de30fe23
Sanitise double slashes, and return nil in get() if a path continues but a node doesn't have children.
2023-07-23 23:19:58 +04:00
5d6a3630c6
Updated README.md.
2023-05-28 04:00:54 +04:00
fcbd09506a
Add a test.
2023-05-28 03:46:09 +04:00
2bfaae11f2
Fixed a typo in get().
2023-05-28 03:18:15 +04:00
257bd7ea76
Check if param names differ.
2023-05-28 03:17:53 +04:00
653bae85f5
Changed comment for Param().
2023-05-28 03:16:41 +04:00
4f54ab4156
Found and fixed a typo. n -> curNode.
2023-05-28 02:43:09 +04:00
9cda541108
Made ServeStatic() to return an error.
2023-05-28 01:49:21 +04:00
89c2333a4f
get and add methods get rewritten in an iterative manner instead of recursive.
2023-05-28 01:46:57 +04:00
538f1bd676
Removed / check that is performed in newPath. Return Not Acceptable if a path not starting with /.
2023-05-28 01:29:01 +04:00
a0b80ced85
Let Handler() return an error instead of panicking. Also removed checks for / and * since they are checked in newPath().
2023-05-28 01:24:18 +04:00
99a7cebd0a
Perform checks for / and * inside a newPath func.
2023-05-28 01:22:28 +04:00
5d7d595df3
Init repo!
2023-05-26 04:06:35 +04:00
9816fc01d1
Initial commit
2023-05-26 01:50:54 +04:00