mirror of
https://github.com/kataras/iris.git
synced 2025-01-23 18:51:03 +01:00
Merge branch 'master' of https://github.com/kataras/iris
Former-commit-id: 91cc725ac4e8260dabeca0bd6e58717fd6d4287e
This commit is contained in:
commit
5de3fc5790
|
@ -223,12 +223,13 @@ func main() {
|
||||||
// This handler will match /users/42
|
// This handler will match /users/42
|
||||||
// but will not match
|
// but will not match
|
||||||
// neither /users or /users/.
|
// neither /users or /users/.
|
||||||
app.Get("/users/{id:int64}", func(ctx iris.Context) {
|
app.Get("/users/{id:long}", func(ctx iris.Context) {
|
||||||
id, _ := ctx.Params().GetUint64("id")
|
id, _ := ctx.Params().GetInt64("id")
|
||||||
ctx.Writef("User with ID: %d", id)
|
ctx.Writef("User with ID: %d", id)
|
||||||
})
|
})
|
||||||
|
|
||||||
// However, this one will match /user/john/ and also /user/john/send.
|
// This handler will match /user/john/send
|
||||||
|
// but will not match /user/john/
|
||||||
app.Post("/user/{name:string}/{action:path}", func(ctx iris.Context) {
|
app.Post("/user/{name:string}/{action:path}", func(ctx iris.Context) {
|
||||||
name := ctx.Params().Get("name")
|
name := ctx.Params().Get("name")
|
||||||
action := ctx.Params().Get("action")
|
action := ctx.Params().Get("action")
|
||||||
|
@ -890,7 +891,7 @@ func main() {
|
||||||
|
|
||||||
### Testing
|
### Testing
|
||||||
|
|
||||||
Iris offers an incredible support for the [httpexpect](github.com/iris-contrib/httpexpect), a Testing Framework for web applications. However, you are able to use the standard Go's `net/http/httptest` package as well but in this example we will use the `kataras/iris/httptest`.
|
Iris offers an incredible support for the [httpexpect](https://github.com/iris-contrib/httpexpect), a Testing Framework for web applications. However, you are able to use the standard Go's `net/http/httptest` package as well but in this example we will use the `kataras/iris/httptest`.
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package main
|
package main
|
||||||
|
|
Loading…
Reference in New Issue
Block a user