mirror of https://github.com/gin-gonic/gin.git
parent
bc2417fc40
commit
830a63d244
8
gin.go
8
gin.go
|
@ -205,7 +205,7 @@ func (engine *Engine) allocateContext() *Context {
|
|||
return &Context{engine: engine, params: &v, skippedNodes: &skippedNodes}
|
||||
}
|
||||
|
||||
// Delims sets template left and right delims and returns a Engine instance.
|
||||
// Delims sets template left and right delims and returns an Engine instance.
|
||||
func (engine *Engine) Delims(left, right string) *Engine {
|
||||
engine.delims = render.Delims{Left: left, Right: right}
|
||||
return engine
|
||||
|
@ -259,7 +259,7 @@ func (engine *Engine) SetFuncMap(funcMap template.FuncMap) {
|
|||
engine.FuncMap = funcMap
|
||||
}
|
||||
|
||||
// NoRoute adds handlers for NoRoute. It return a 404 code by default.
|
||||
// NoRoute adds handlers for NoRoute. It returns a 404 code by default.
|
||||
func (engine *Engine) NoRoute(handlers ...HandlerFunc) {
|
||||
engine.noRoute = handlers
|
||||
engine.rebuild404Handlers()
|
||||
|
@ -271,7 +271,7 @@ func (engine *Engine) NoMethod(handlers ...HandlerFunc) {
|
|||
engine.rebuild405Handlers()
|
||||
}
|
||||
|
||||
// Use attaches a global middleware to the router. ie. the middleware attached through Use() will be
|
||||
// Use attaches a global middleware to the router. i.e. the middleware attached through Use() will be
|
||||
// included in the handlers chain for every single request. Even 404, 405, static files...
|
||||
// For example, this is the right place for a logger or error management middleware.
|
||||
func (engine *Engine) Use(middleware ...HandlerFunc) IRoutes {
|
||||
|
@ -442,7 +442,7 @@ func (engine *Engine) RunTLS(addr, certFile, keyFile string) (err error) {
|
|||
}
|
||||
|
||||
// RunUnix attaches the router to a http.Server and starts listening and serving HTTP requests
|
||||
// through the specified unix socket (ie. a file).
|
||||
// through the specified unix socket (i.e. a file).
|
||||
// Note: this method will block the calling goroutine indefinitely unless an error happens.
|
||||
func (engine *Engine) RunUnix(file string) (err error) {
|
||||
debugPrint("Listening and serving HTTP on unix:/%s", file)
|
||||
|
|
|
@ -70,7 +70,7 @@ type LogFormatterParams struct {
|
|||
Path string
|
||||
// ErrorMessage is set if error has occurred in processing the request.
|
||||
ErrorMessage string
|
||||
// isTerm shows whether does gin's output descriptor refers to a terminal.
|
||||
// isTerm shows whether gin's output descriptor refers to a terminal.
|
||||
isTerm bool
|
||||
// BodySize is the size of the Response Body
|
||||
BodySize int
|
||||
|
@ -178,7 +178,7 @@ func ErrorLoggerT(typ ErrorType) HandlerFunc {
|
|||
}
|
||||
|
||||
// Logger instances a Logger middleware that will write the logs to gin.DefaultWriter.
|
||||
// By default gin.DefaultWriter = os.Stdout.
|
||||
// By default, gin.DefaultWriter = os.Stdout.
|
||||
func Logger() HandlerFunc {
|
||||
return LoggerWithConfig(LoggerConfig{})
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ func function(pc uintptr) []byte {
|
|||
// runtime/debug.*T·ptrmethod
|
||||
// and want
|
||||
// *T.ptrmethod
|
||||
// Also the package path might contains dot (e.g. code.google.com/...),
|
||||
// Also the package path might contain dot (e.g. code.google.com/...),
|
||||
// so first eliminate the path prefix
|
||||
if lastSlash := bytes.LastIndex(name, slash); lastSlash >= 0 {
|
||||
name = name[lastSlash+1:]
|
||||
|
|
Loading…
Reference in New Issue