Sha256: fd601ff3fe3cc1f7c658344e4ef109687be399ecf1ededbaeebbc34de2ed9322

Contents?: true

Size: 1.19 KB

Versions: 34

Compression:

Stored size: 1.19 KB

Contents

# *Flexirest:* Faraday configuration

Flexirest uses Faraday to allow switching HTTP backends, the default is to just use Faraday's default. To change the used backend just set it in the class by setting `adapter` to a Faraday supported adapter symbol.

```ruby
Flexirest::Base.adapter = :net_http
# or ...
Flexirest::Base.adapter = :patron
```

In versions before 1.2.0 the adapter was hardcoded to `:patron`, so if you want to ensure it still uses Patron, you should set this setting.

If you want more control you can pass a **complete** configuration block ("complete" means that the block does not _override_ [the default configuration](https://github.com/flexirest/flexirest/blob/master/lib/flexirest/configuration.rb#L292), but rather _replaces_ it).

For available configuration variables look into the [Faraday documentation](https://github.com/lostisland/faraday).

```ruby
Flexirest::Base.faraday_config do |faraday|
  faraday.adapter(:net_http)
  faraday.options.timeout       = 10
  faraday.ssl.verify            = false
  faraday.headers['User-Agent'] = "Flexirest/#{Flexirest::VERSION}"
end
```


-----

[< Ruby on Rails integration](ruby-on-rails-integration.md) | [Associations >](associations.md)

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
flexirest-1.12.4 docs/faraday-configuration.md
flexirest-1.12.3 docs/faraday-configuration.md
flexirest-1.12.2 docs/faraday-configuration.md
flexirest-1.12.1 docs/faraday-configuration.md
flexirest-1.12.0 docs/faraday-configuration.md
flexirest-1.11.3 docs/faraday-configuration.md
flexirest-1.11.2 docs/faraday-configuration.md
flexirest-1.11.1 docs/faraday-configuration.md
flexirest-1.11.0 docs/faraday-configuration.md
flexirest-1.10.12 docs/faraday-configuration.md
flexirest-1.10.11 docs/faraday-configuration.md
flexirest-1.10.10 docs/faraday-configuration.md
flexirest-1.10.9 docs/faraday-configuration.md
flexirest-1.10.8 docs/faraday-configuration.md
flexirest-1.10.7 docs/faraday-configuration.md
flexirest-1.10.6 docs/faraday-configuration.md
flexirest-1.10.5 docs/faraday-configuration.md
flexirest-1.10.4 docs/faraday-configuration.md
flexirest-1.10.3 docs/faraday-configuration.md
flexirest-1.10.2 docs/faraday-configuration.md