Domain Availability Checker

PAYANT
Par | Mise à jour לפני 23 ימים | Tools
Popularité

9.5 / 10

Latence

2,241ms

Niveau de service

98%

Health Check

N/A

Retour à toutes les discussions

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.

Participez à la discussion - ajoutez un commentaire ci-dessous:

Connectez-vous / Inscrivez-vous pour publier de nouveaux commentaires