vapi icon indicating copy to clipboard operation
vapi copied to clipboard

Fix api2/user/login

Open chovanecadam opened this issue 3 years ago • 2 comments

There is a discrepancy between postman docs that specify JSON payload and the current implementation that uses x-www-form-urlencoded. This pull request fixes this issue.

Currently this is possible:

curl http://localhost/vapi/api2/user/login -X POST -d '[email protected]&password=zTyBwV/9'
# {"success":"true","token":"REDACTED"}

But the postman docs says the payload should be a JSON:

{
    "email":"",
    "password":""
}

After my change, the application accepts the JSON payload.

curl http://localhost/vapi/api2/user/login -X POST -H 'Content-Type: application/json' -d '{"email": "[email protected]", "password": "zTyBwV/9"}' -v
# {"success":"true","token":"REDACTED"}

chovanecadam avatar Apr 30 '22 00:04 chovanecadam

Could you confirm if you have tested this and its working fine? Thanks

roottusk avatar Jun 03 '22 04:06 roottusk

I believe in the previous code also it used to accept JSON, Maybe the code that you have committed strictly checks for JSON, Is that the case?

roottusk avatar Jun 03 '22 04:06 roottusk