EOF occurs sending a POST with curl
- Dominant language
- Go
- Stars
- 25.6k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the issue you are facing or ask for help
I used example code like this:
```func create(ctx iris.Context) {
var b Book
err := ctx.ReadJSON(&b)
// TIP: use ctx.ReadBody(&b) to bind
// any type of incoming data instead.
if err != nil {
ctx.StopWithProblem(iris.StatusBadRequest, iris.NewProblem().
Title("Book creation failure").DetailErr(err))
// TIP: use ctx.StopWithError(code, err) when only
// plain text responses are expected on errors.
return
}
println("Received Book: " + b.Title)
ctx.StatusCode(iris.StatusCreated)
}
```
and I ran the server and sent a POST by curl like

then a response with detail EOF returned

My every step is the same as in the example docs,i don't understand why
Contributor guide
Research direction
Start with the shown create handler and the curl request in the linked screenshot, then reproduce the POST against the example documentation. Check that the request contains the expected JSON body and reaches ctx.ReadJSON; done means the handler returns 201 and prints the received book title instead of returning EOF.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100