You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
newUser := &models.User{
Name: "New user",
Email: "new@test.com",
}
res := as.HTML("/users").Post(newUser)
The code seems to be identical as in the example.
However, I get an error: invalid character 'C' looking for beginning of value
When I log c.Request().Body in my action I get CreatedAt=&Email=new%40test.com&ID=00000000-0000-0000-0000-000000000000&Name=New+user&UpdatedAt=
I understand that is where 'C' in the error comes from.
However, if I test my endpoint from Postman in the live app, c.Request().Body logs
{
"name": "New User",
"email": "test@test.lt"
}
It seams like Post method sends my model's data as parameters instead of json body.
How could this be fixed?
Thank you for your help!
The text was updated successfully, but these errors were encountered:
Hi,
In my test I am doing this:
The code seems to be identical as in the example.
However, I get an error:
invalid character 'C' looking for beginning of value
When I log
c.Request().Body
in my action I getCreatedAt=&Email=new%40test.com&ID=00000000-0000-0000-0000-000000000000&Name=New+user&UpdatedAt=
I understand that is where 'C' in the error comes from.
However, if I test my endpoint from Postman in the live app,
c.Request().Body
logsIt seams like Post method sends my model's data as parameters instead of json body.
How could this be fixed?
Thank you for your help!
The text was updated successfully, but these errors were encountered: