JSON API 용 Ruby 래퍼를 작성하고 있습니다. 성공적인 게시물이 해당 끝점으로 전송 될 때 특정 유형의 응답을 기대합니다 ... 그러나 실제로 응답을 얻는 방법을 모르겠습니다.패러데이의 응답을 테스트하려면 어떻게합니까?
나는이 같은 패러데이을 사용하고 있습니다 :
@connection ||= Faraday.new do |f|
f.url_prefix = "https://myapiurl.com/api/auth"
f.adapter :net_http
f.headers['User-Agent'] = "Some-Awesome-User-Agent"
f.headers['Content-Type'] = content_type
f.headers['Accept'] = api_version
f.params['API-KEY'] = api_key if api_key
f.response :json, content_type: /\bjson$/
end
을 그러나, 나는 @connection.post
을 수행 할 때, 내가 SSL 오류가 점점 계속 : 나는이 문제를 해결할 수 있습니다 일단 오해하지 않다 경우
@connection.post
Faraday::SSLError: SSL_connect returned=1 errno=0 state=error: certificate verify failed
을 SSL 오류가 발생했습니다. 응답 객체를 받아야 제대로 작동 할 수 있습니까?
편집 내가 rvm 1.27.0 (latest)
이이처럼 내 Gemfile.lock
는 모습입니다 함께, 또한 OpenSSL 0.9.8zh 14 Jan 2016
, ruby 2.3.1
을 사용하고 1
: 당신의 SSL 인증서 때문에이 오류가
PATH
remote: .
specs:
mygem (0.1.0)
GEM
remote: https://rubygems.org/
specs:
coderay (1.1.1)
diff-lcs (1.2.5)
faraday (0.9.2)
multipart-post (>= 1.2, < 3)
faraday_middleware (0.10.0)
faraday (>= 0.7.4, < 0.10)
json (2.0.2)
method_source (0.8.2)
multipart-post (2.0.0)
pry (0.10.4)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
rake (10.5.0)
rspec (3.5.0)
rspec-core (~> 3.5.0)
rspec-expectations (~> 3.5.0)
rspec-mocks (~> 3.5.0)
rspec-core (3.5.1)
rspec-support (~> 3.5.0)
rspec-expectations (3.5.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0)
rspec-mocks (3.5.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.5.0)
rspec-support (3.5.0)
slop (3.6.0)
PLATFORMS
ruby
DEPENDENCIES
bundler (~> 1.11)
faraday (~> 0.9.2)
faraday_middleware (~> 0.10.0)
json (~> 2.0, >= 2.0.2)
mygem
pry (~> 0.10.4)
rake (~> 10.0)
rspec (~> 3.0)
rspec-expectations (~> 3.5)
BUNDLED WITH
1.12.5