Domain Availability Checker

שולם
על ידי | מְעוּדכָּן לפני 23 ימים | Tools
פּוֹפּוּלָרִיוּת

9.5 / 10

חֶבִיוֹן

2,241ms

רמת שירות

98%

Health Check

N/A

חזרה לכל הדיונים

Getting HTTP 400 when testing with Unirest and Ruby

Rapid account: Techie
techie
לפני 8 שנים

Hi,
I have written a simple request to the API using ruby but I get a HTTP 400 (bad request). Can you please help?
I have tested this with CURL, that works fine.
I am using the following version of ruby on Mac OSX El Capitan - ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]

=Ruby Code Below===

require 'unirest'
# These code snippets use an open-source library.
response = Unirest.post "https://domainstatus.p.mashape.com/", headers:{
"X-Mashape-Key" => "S6Kd4NibK4mshZ34TX0qAqBxM6tUp17qJZijsn0EIaKcQtquFH",
"Content-Type" => "application/json",
"Accept" => "application/json"
}
"{\"domain\":\"http://www.www.amazon.co.uk/whatever\"}"

puts response.code
puts response.headers
puts response.body
puts response.raw_body
Rapid account: Navii
navii Commented לפני 7 שנים

Sorry, I’m not familiar with Ruby.

הצטרף לדיון - הוסף תגובה למטה:

התחבר / הירשם כדי לפרסם תגובות חדשות