1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-20 11:27:06 +00:00

add Context.SetVersion helper

Former-commit-id: 605d6c1e78f73b8f2c89bd2dc7ee23f21551d47b
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-05-06 07:17:24 +03:00
parent 24665990ce
commit d19672115b
7 changed files with 48 additions and 18 deletions

View File

@@ -43,7 +43,7 @@ func NewMatcher(versions Map) context.Handler {
return func(ctx context.Context) {
versionString := GetVersion(ctx)
if versionString == NotFound {
if versionString == "" || versionString == NotFound {
notFoundHandler(ctx)
return
}
@@ -63,7 +63,7 @@ func NewMatcher(versions Map) context.Handler {
}
// pass the not matched version so the not found handler can have knowedge about it.
// ctx.Values().Set(Key, versionString)
// ctx.SetVersion(versionString)
// or let a manual cal of GetVersion(ctx) do that instead.
notFoundHandler(ctx)
}