Domain Availability Checker

PAGATO
Da | Aggiornamento 22 days ago | Tools
Popolaritร 

9.5 / 10

Latenza

2,251ms

Livello di servizio

98%

Health Check

N/A

Torna a tutte le discussioni

Getting HTTP 400 when testing with Unirest and Ruby

Rapid account: Techie
techie
8 years ago

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 years ago

Sorry, Iโ€™m not familiar with Ruby.

Partecipa alla discussione - aggiungi un commento di seguito:

Accedi/Iscriviti per pubblicare nuovi commenti