I'm trying to send a curl request. This is my request:
curl -H "Content-Type: application/json" -X POST -d '{"username":"tahereh","password":"1234", "admin":true}' http://localhost:8000/users
I decode this request in my code and store it in 'user var' of code's User struct, like this:
var newUser models.User //User is an struct in model package
err1 := json.NewDecoder(r.Body).Decode(&newUser)
Then I debug my code with dlv debug
command line. My problem is when I print newUser
with print newUser
in dlv
all of the variable correctly set except the boolean value. While I'm sending the true value through curl request, it sets to false!
point: I have printed the err1, it's also null.