mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-27 19:00:35 +00:00
18 lines
369 B
Go
18 lines
369 B
Go
|
package middleware
|
||
|
|
||
|
import (
|
||
|
"github.com/drone/drone/stream"
|
||
|
|
||
|
"github.com/codegangsta/cli"
|
||
|
"github.com/gin-gonic/gin"
|
||
|
)
|
||
|
|
||
|
// Stream is a middleware function that initializes the Stream and attaches to
|
||
|
// the context of every http.Request.
|
||
|
func Stream(cli *cli.Context) gin.HandlerFunc {
|
||
|
v := stream.New()
|
||
|
return func(c *gin.Context) {
|
||
|
stream.ToContext(c, v)
|
||
|
}
|
||
|
}
|