开发者

how do i add header for json request with rails?

I have run this below curl command in the terminal,

curl -H "Content-Type:application/json" -H "Accept:application/json" -H   -d "{\"request\":{\"parent_rrn\":\"8809073722344\",\"kid_guid\":\"blah-blah\"}}"   http://localhost:8080/api/validate -u username:password

and its running successfully

but i have to pass the below parameter with the testcases request

-H "Content-Type:application/json", -u username:password

i have tried the below code but those content details and access details are not passing, see the my code as belo开发者_如何学Gow,

post 'validate',:request => "{\"kid_rrn\":\"93name\":\"kid1\",\"parent_rrn\":\"8809073722344\",\"kid_guid\":\"blah-blah\"}", :header => {'Authendication' : 'username:password', 'Content_Type' : 'application/json'}

Could you please help me, how do i add headers in this?

Thanks Pragash

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜