lostisland / faraday

Simple, but flexible HTTP client library, with support for multiple backends.
https://lostisland.github.io/faraday
MIT License
5.73k stars 976 forks source link

Add tests and documentation to make sure adapters support streaming requests #1554

Open iMacTia opened 7 months ago

iMacTia commented 7 months ago

Issue description

This came out of a recent exchange I had as part of this async-http-faraday issue. Adapters are required to support streaming requests (i.e. IO Stream bodies that respond to #read) to correctly support multipart requests.

This should be correctly spelled out in the documentation and we should also add specs to the "adapter tests" so that external adapters can check if they're compliant or not.

ioquatix commented 7 months ago

(How do we use adapter tests?)

iMacTia commented 7 months ago

This is currently supported for RSpec only. You require 'faraday_specs_setup' in your spec_helper.rb and then call it_behaves_like 'an adapter' from your adapter. You can also optionally turn on some tests for "optional feature" if your adapter supports them. You can see an example in the template repo.