में पोर्ट को कैसे सेट करें मैंने पढ़ा है कि HTTParty SSL if the port is set to 443 का उपयोग करता है, लेकिन मुझे पोर्ट को सेट करने का तरीका नहीं दिखाई देता है। क्या कोई मेरे लिए यह स्पष्ट कर सकता है?HTTParty
Q
HTTParty
6
A
उत्तर
4
चेक चश्मा:
लक्ष्य यूआरएल पोर्ट 443 बस लक्ष्य के अंत में :443
जोड़ने का उपयोग करने की उम्मीद है यूआरआई HTTParty बनाने के लिए उपयोग एसएसएल पर्याप्त होना चाहिए।
वैसे, HTTPS URL भी एसएसएल का उपयोग करेंगे।
उदाहरण:
http://foo.com => no SSL
https://foo.com => SSL
http://foo.com:443 => SSL
3
यह वास्तव में डिफ़ॉल्ट रूप से HTTPS का उपयोग करता है, जब तक कि पोर्ट 80 है और अनुरोध है http:
describe Foo do
it 'is https' do
adapter = HTTParty::ConnectionAdapter.new(URI(subject.base_uri))
expect(adapter.connection.use_ssl?).to eq(true)
end
end
:
context "using port 80" do
let(:uri) { URI 'http://foobar.com' }
it { should_not use_ssl }
end
context "using port 443 for ssl" do
let(:uri) { URI 'https://api.foo.com/v1:443' }
it { should use_ssl }
end
context "https scheme with default port" do
it { should use_ssl }
end
context "https scheme with non-standard port" do
let(:uri) { URI 'https://foobar.com:123456' }
it { should use_ssl }
end
https://github.com/jnunemaker/httparty/blob/master/spec/httparty/connection_adapter_spec.rb
यहाँ मेरी कल्पना है
+1। URL में 'https: //' निर्दिष्ट करने के लिए सर्वश्रेष्ठ, क्योंकि पोर्ट स्वचालित रूप से 443 पर डिफ़ॉल्ट होगा। –
@MarkThomas से सहमत हुए। यह जानकर अच्छा लगा कि आप वैसे भी दोनों का उपयोग कर सकते हैं। – robertodecurnex