简体   繁体   中英

How to access the body from a request Ruby on rails

I tried to do a Postman request to this endpoint http://127.0.0.1:3000/api/v1/login with this body:

{
"username": "Sebastiansantander",
"password": "1233342"

}

I tried using params.permit[:username,:password] but the problem is that I cant use them.

how can I access to that parameters in order to use them.

There is a little different syntax to achieve that params.permit(:username, password) and then in your code params[:username]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM