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

(#1554) Add support for all common compressions (write and read)

- Remove the context.Context interface and export the *context, the iris.Context now points to the pointer\nSupport compression and rate limiting in the FileServer\nBit of code organisation


Former-commit-id: ad1c61bf968059510c6be9e7f2cceec7da70ba17
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-07-10 23:21:09 +03:00
parent 645da2b2ef
commit 0f113dfcda
112 changed files with 2119 additions and 3390 deletions

View File

@@ -331,7 +331,7 @@ const JetRuntimeVarsContextKey = "iris.jetvarmap"
//
// Usage: view.AddJetRuntimeVars(ctx, view.JetRuntimeVars{...}).
// See `JetEngine.AddRuntimeVars` too.
func AddJetRuntimeVars(ctx context.Context, jetVarMap JetRuntimeVars) {
func AddJetRuntimeVars(ctx *context.Context, jetVarMap JetRuntimeVars) {
if v := ctx.Values().Get(JetRuntimeVarsContextKey); v != nil {
if vars, ok := v.(JetRuntimeVars); ok {
for key, value := range jetVarMap {
@@ -350,7 +350,7 @@ func AddJetRuntimeVars(ctx context.Context, jetVarMap JetRuntimeVars) {
//
// Usage: view.AddJetRuntimeVars(ctx, view.JetRuntimeVars{...}).
// See `view.AddJetRuntimeVars` if package-level access is more meanful to the code flow.
func (s *JetEngine) AddRuntimeVars(ctx context.Context, vars JetRuntimeVars) {
func (s *JetEngine) AddRuntimeVars(ctx *context.Context, vars JetRuntimeVars) {
AddJetRuntimeVars(ctx, vars)
}
@@ -363,7 +363,7 @@ func (s *JetEngine) ExecuteWriter(w io.Writer, filename string, layout string, b
var vars JetRuntimeVars
if ctx, ok := w.(context.Context); ok {
if ctx, ok := w.(*context.Context); ok {
runtimeVars := ctx.Values().Get(JetRuntimeVarsContextKey)
if runtimeVars != nil {
if jetVars, ok := runtimeVars.(JetRuntimeVars); ok {