Duplicating a curl command

182 views
Skip to first unread message

vanderkerkoff

unread,
Aug 5, 2015, 4:25:16 PM8/5/15
to HTTParty Gem
Hello everyone

Sorry if this gets double posted, I posted a topic a while back but it hasn't appeared.

I'm trying to duplicate this curl command in httparty, but can't work it out.

curl http://127.0.0.1:5000/email_id -d "data=00700001" -X GET

I'm using httparty 0.8.3.

I've tried alot of variations of this

    payload = {"body" => {"data" => '00700001'}, :headers => { 'Content-Type' => 'application/x-www-form-urlencoded' }}
    response = HTTParty.get(url, payload)

But I just keep getting back {"message"=>"The browser (or proxy) sent a request that this server could not understand."}

Anyone got any ideas?

vanderkerkoff

unread,
Aug 6, 2015, 5:56:49 AM8/6/15
to HTTParty Gem
Worked it out in the end, pretty simple

response = HTTParty.get('http://127.0.0.1:5000/email_id', :body => {:data => '00700001'})
Reply all
Reply to author
Forward
0 new messages