1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-27 14:57:05 +00:00

🔗 prepare next version: add builtin dependencies for headers, http request, http response writer for convenience

Former-commit-id: 6f4b291a50cb1083532d7a13f64ea51e89b5ee21
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-03-01 09:24:11 +02:00
parent 1c9b592088
commit afd0f5caef
2 changed files with 72 additions and 5 deletions

View File

@@ -2,6 +2,7 @@ package hero
import (
stdContext "context"
"net/http"
"time"
"github.com/kataras/iris/v12/context"
@@ -57,7 +58,18 @@ var BuiltinDependencies = []*Dependency{
NewDependency(func(ctx context.Context) time.Time {
return time.Now()
}).Explicitly(),
// standard http Request dependency.
NewDependency(func(ctx context.Context) *http.Request {
return ctx.Request()
}).Explicitly(),
// standard http ResponseWriter dependency.
NewDependency(func(ctx context.Context) http.ResponseWriter {
return ctx.ResponseWriter()
}).Explicitly(),
// http headers dependency.
NewDependency(func(ctx context.Context) http.Header {
return ctx.Request().Header
}).Explicitly(),
// payload and param bindings are dynamically allocated and declared at the end of the `binding` source file.
}