mirror of
https://gitee.com/johng/gf.git
synced 2024-12-05 05:37:55 +08:00
24 lines
702 B
Go
24 lines
702 B
Go
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
|
|
//
|
|
// This Source Code Form is subject to the terms of the MIT License.
|
|
// If a copy of the MIT was not distributed with this file,
|
|
// You can obtain one at https://github.com/gogf/gf.
|
|
|
|
package ghttp
|
|
|
|
import "net/http"
|
|
|
|
// WrapF is a helper function for wrapping http.HandlerFunc and returns a ghttp.HandlerFunc.
|
|
func WrapF(f http.HandlerFunc) HandlerFunc {
|
|
return func(r *Request) {
|
|
f(r.Response.Writer, r.Request)
|
|
}
|
|
}
|
|
|
|
// WrapH is a helper function for wrapping http.Handler and returns a ghttp.HandlerFunc.
|
|
func WrapH(h http.Handler) HandlerFunc {
|
|
return func(r *Request) {
|
|
h.ServeHTTP(r.Response.Writer, r.Request)
|
|
}
|
|
}
|