【问题标题】:Preflight OPTIONS request with Faraday gem使用 Faraday gem 的 Preflight OPTIONS 请求
【发布时间】:2016-06-10 14:45:12
【问题描述】:

如何使用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

【问题讨论】:

    标签: ruby faraday preflight


    【解决方案1】:

    作为一个might see,语法糖提供给所有methods,除了:options。要执行这样的请求,可以直接调用包装好的Connection#run_request

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

    【讨论】:

      猜你喜欢
      • 2014-04-25
      • 2015-02-28
      • 2018-07-03
      • 2017-04-14
      • 2012-12-22
      • 2021-02-22
      • 1970-01-01
      • 2012-12-31
      • 2012-09-16
      相关资源
      最近更新 更多