Domain Availability Checker

유료
분류별 | 업데이트됨 21 days ago | Tools
인기

9.4 / 10

지연 시간

2,253ms

서비스 수준

98%

Health Check

N/A

모든 토론으로 돌아가기

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.

아래에 의견을 추가하고 토론에 참여하세요.

새 댓글을 게시하려면 로그인 / 가입