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
package handlers
func LogiReq(c *gofr.Context) (interface{}, error) {
c.Logger.Info("Login request ")
var login models.Login
err := c.Bind(&login)
if err != nil {
c.Logger.Errorf("Error in binding request body %w ", err)
}
c.Logger.Info("Login request for username ", login.Username)
return login.Username, nil
}
The above code throws error on c.Bind.
*ERRO [14:06:48] Error in binding request body %!w(json.SyntaxError=&{invalid character 'u' looking for beginning of value 1}) StackTrace: goroutine 82 [running]:
However, it works fine when the request is sent from PostMan
The text was updated successfully, but these errors were encountered:
Here is the HTML form
The header value of content type is application/x-www-form-urlencoded
The above code throws error on c.Bind.
*ERRO [14:06:48] Error in binding request body %!w(json.SyntaxError=&{invalid character 'u' looking for beginning of value 1}) StackTrace: goroutine 82 [running]:
However, it works fine when the request is sent from PostMan
The text was updated successfully, but these errors were encountered: