法拉第 gem 的预检选项请求

Preflight OPTIONS request with Faraday gem

如何使用 Faraday 进行预检请求?好像名字冲突了。

# Create a connection
conn = Faraday.new('http://example.com')

# GET request
conn.get # => #<Faraday::Response

# POST request
conn.post # => #<Faraday::Response

# OPTIONS request collides?
conn.options # => #<struct Faraday::RequestOptions

作为一个 might see, the syntactic sugar is provided for all methods, save for :options. To perform such a request, one might call the wrapped Connection#run_request 直接:

conn.run_request(:options, nil, nil, nil)