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

remove any reference to the pre go1.9 context.Context and replace with iris.Context on some places that were forgotten

got an email feedback about this


Former-commit-id: b1caa261a0d425d8db2091bffb8cfd6065c4e1fa
This commit is contained in:
Gerasimos (Makis) Maropoulos
2019-08-11 15:43:47 +03:00
parent 943c3f77cb
commit 5c91440e46
11 changed files with 29 additions and 33 deletions

View File

@@ -2,23 +2,22 @@ package main
import (
"github.com/kataras/iris"
"github.com/kataras/iris/context"
)
func main() {
app := iris.New()
app.Get("/", func(ctx context.Context) /* or iris.Context, it's the same for Go 1.9+. */ {
app.Get("/", func(ctx iris.Context) {
// GetReferrer extracts and returns the information from the "Referer" header as specified
// in https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy or by the URL query parameter "referer".
r := ctx.GetReferrer()
switch r.Type {
case context.ReferrerSearch:
case iris.ReferrerSearch:
ctx.Writef("Search %s: %s\n", r.Label, r.Query)
ctx.Writef("Google: %s\n", r.GoogleType)
case context.ReferrerSocial:
case iris.ReferrerSocial:
ctx.Writef("Social %s\n", r.Label)
case context.ReferrerIndirect:
case iris.ReferrerIndirect:
ctx.Writef("Indirect: %s\n", r.URL)
}
})