mirror of
https://github.com/labstack/echo.git
synced 2024-12-24 20:14:31 +02:00
Removed some unwanted code
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
parent
4426751c93
commit
4903cba3e3
11
bolt.go
11
bolt.go
@ -56,6 +56,12 @@ func New(opts ...func(*Bolt)) (b *Bolt) {
|
||||
c.Halt()
|
||||
},
|
||||
}
|
||||
|
||||
// Set options
|
||||
for _, o := range opts {
|
||||
o(b)
|
||||
}
|
||||
|
||||
b.Router = NewRouter(b)
|
||||
b.pool.New = func() interface{} {
|
||||
return &Context{
|
||||
@ -67,11 +73,6 @@ func New(opts ...func(*Bolt)) (b *Bolt) {
|
||||
}
|
||||
}
|
||||
|
||||
// Set options
|
||||
for _, o := range opts {
|
||||
o(b)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,13 @@ var u = user{
|
||||
Name: "Joe",
|
||||
}
|
||||
|
||||
func TestMaxParam(t *testing.T) {
|
||||
b := New(MaxParam(8))
|
||||
if b.maxParam != 8 {
|
||||
t.Errorf("max param should be 8, found %d", b.maxParam)
|
||||
}
|
||||
}
|
||||
|
||||
func TestIndex(t *testing.T) {
|
||||
b := New()
|
||||
b.Index("example/public/index.html")
|
||||
|
@ -3,14 +3,12 @@ package bolt
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"sync"
|
||||
)
|
||||
|
||||
type (
|
||||
router struct {
|
||||
bolt *Bolt
|
||||
pool sync.Pool
|
||||
root *node
|
||||
bolt *Bolt
|
||||
}
|
||||
node struct {
|
||||
label byte
|
||||
@ -43,15 +41,12 @@ const (
|
||||
|
||||
func NewRouter(b *Bolt) (r *router) {
|
||||
r = &router{
|
||||
bolt: b,
|
||||
root: &node{
|
||||
prefix: "",
|
||||
handlers: make([]HandlerFunc, len(MethodMap)),
|
||||
edges: edges{},
|
||||
},
|
||||
}
|
||||
r.pool.New = func() interface{} {
|
||||
return make(Params, 0, b.maxParam)
|
||||
bolt: b,
|
||||
}
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user