| 128 | } |
| 129 | |
| 130 | func h(ctx iris.Context) { |
| 131 | method := ctx.Method() // the http method requested a server's resource. |
| 132 | subdomain := ctx.Subdomain() // the subdomain, if any. |
| 133 | |
| 134 | // the request path (without scheme and host). |
| 135 | path := ctx.Path() |
| 136 | // how to get all parameters, if we don't know |
| 137 | // the names: |
| 138 | paramsLen := ctx.Params().Len() |
| 139 | |
| 140 | ctx.Params().Visit(func(name string, value string) { |
| 141 | ctx.Writef("%s = %s\n", name, value) |
| 142 | }) |
| 143 | ctx.Writef("Info\n\n") |
| 144 | ctx.Writef("Method: %s\nSubdomain: %s\nPath: %s\nParameters length: %d", method, subdomain, path, paramsLen) |
| 145 | } |
| 146 | |
| 147 | func main() { |
| 148 | app := newApp() |