Golang ShouldBindJSON giving errors as unexpected EOF and i/o timeout

123 Views Asked by At

With Golang ShouldBindJSON(&dto) sometimes I'm getting three kings of errors. I have a dto struct as given below

type RequestDto struct {
    Customers []CustomerDto `json:"customers" binding:"required,max=100,dive"`
}

type CustomerDto struct {
    Name       string    `json:"name" binding:"required"`
    Roles map[string]any `json:"roles"`
}

One of the error that I'm getting is customer.RequestDto.Customers: []customer.CustomerDto: customer.CustomerDto.Roles: unexpected EOF

Another one is customer.RequestDto.Customers: []customer.CustomerDto: customer.CustomerDto.Roles: read tcp 10.216.24.153:8000->127.0.0.6:58167: i/o timeout

And last one is just EOF

What might be the reason for it? How to solve it? Thanks.

0

There are 0 best solutions below