1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-21 20:07:04 +00:00
Former-commit-id: bd6e0eb0508fb27aea2ff79ad3a82c0acdd51eb7
This commit is contained in:
Gerasimos (Makis) Maropoulos
2019-07-25 17:08:16 +03:00
parent 53b2a22579
commit f3162254a0
3 changed files with 177 additions and 10 deletions

View File

@@ -8,9 +8,11 @@ func main() {
app := iris.New()
app.Post("/", logAllBody, logJSON, logFormValues, func(ctx iris.Context) {
body, err := ctx.GetBody()
// body, err := ioutil.ReadAll(ctx.Request().Body) once or
body, err := ctx.GetBody() // as many times as you need.
if err != nil {
ctx.Writef("error while reading the requested body: %v", err)
ctx.StatusCode(iris.StatusInternalServerError)
ctx.WriteString(err.Error())
return
}