MCPcopy Create free account
hub / github.com/kataras/iris / matchVersionRange

Function matchVersionRange

versioning/version.go:103–133  ·  view source on GitHub ↗
(ctx *context.Context, validate semver.Range)

Source from the content-addressed store, hash-verified

101}
102
103func matchVersionRange(ctx *context.Context, validate semver.Range) bool {
104 gotVersion := GetVersion(ctx)
105
106 alias, aliasFound := GetVersionAlias(ctx, gotVersion)
107 if aliasFound {
108 SetVersion(ctx, alias) // set the version so next routes have it already.
109 gotVersion = alias
110 }
111
112 if gotVersion == "" {
113 return false
114 }
115
116 v, err := semver.Make(gotVersion)
117 if err != nil {
118 return false
119 }
120
121 if !validate(v) {
122 return false
123 }
124
125 versionString := v.String()
126
127 if !aliasFound { // don't lose any time to set if already set.
128 SetVersion(ctx, versionString)
129 }
130
131 ctx.Header(APIVersionResponseHeader, versionString)
132 return true
133}
134
135// GetVersion returns the current request version.
136//

Callers 2

makeHandlerFunction · 0.85
MatchFunction · 0.85

Calls 5

GetVersionFunction · 0.85
GetVersionAliasFunction · 0.85
SetVersionFunction · 0.85
StringMethod · 0.65
HeaderMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…