Skip to content

Commit 3ea0878

Browse files
committed
Bone: Fix ParamWrite
1 parent 5d84f99 commit 3ea0878

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

bench_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ func BenchmarkBeego_ParamWrite(b *testing.B) {
615615
benchRequest(b, router, r)
616616
}
617617
func BenchmarkBone_ParamWrite(b *testing.B) {
618-
router := loadBoneSingle("GET", "/user/:name", http.HandlerFunc(patHandlerWrite))
618+
router := loadBoneSingle("GET", "/user/:name", http.HandlerFunc(boneHandlerWrite))
619619

620620
r, _ := http.NewRequest("GET", "/user/gordon", nil)
621621
benchRequest(b, router, r)

routers.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ func loadBeegoSingle(method, path string, handler beego.FilterFunc) http.Handler
199199
}
200200

201201
// bone
202+
func boneHandlerWrite(rw http.ResponseWriter, req *http.Request) {
203+
io.WriteString(rw, bone.GetValue(req, "name"))
204+
}
205+
202206
func loadBone(routes []route) http.Handler {
203207
router := bone.New()
204208
for _, route := range routes {

0 commit comments

Comments
 (0)