I ran the below curl command in terminal
curl -d "message" http://localhost:8080/api/validate -u username:password
and is running as expected.
I am writing a functional test for the above in Rails. For doing this I have to call the post
method and pass the arguments whatever I have done for curl
to post
.
post 'validate',:request => "message"
I am able to pass the request paramater successfully. But how do I pass the username and password that I am passing in Curl to the post method in rails. Please advise