Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated Faraday::UploadIO #1307

Merged
merged 2 commits into from
Aug 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Faraday::Middleware.register_middleware(name: klass)

* Rename `Faraday::Request#method` to `#http_method`.
* Remove `Faraday::Response::Middleware`. You can now use the new `on_complete` callback provided by `Faraday::Middleware`.
* Drop `Faraday::UploadIO` in favour of `Faraday::FilePart`.

## Faraday 1.0

Expand Down
6 changes: 0 additions & 6 deletions lib/faraday/file_part.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@ module Faraday
# @return [IO]
FilePart = ::UploadIO

# Multipart value used to POST a file.
#
# @deprecated Use FilePart instead of this class. It behaves identically, with
# a matching name to ParamPart.
UploadIO = ::UploadIO

Parts = ::Parts

# Similar to, but not compatible with CompositeReadIO provided by the
Expand Down
10 changes: 5 additions & 5 deletions spec/faraday/request/multipart_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
{
a: 1,
b: {
c: Faraday::UploadIO.new(__FILE__, 'text/x-ruby', nil,
c: Faraday::FilePart.new(__FILE__, 'text/x-ruby', nil,
'Content-Disposition' => 'form-data; foo=1'),
d: 2
}
Expand Down Expand Up @@ -207,7 +207,7 @@
let(:payload) do
{
json: Faraday::ParamPart.new(json, 'application/json'),
io: Faraday::UploadIO.new(io, 'application/pdf')
io: Faraday::FilePart.new(io, 'application/pdf')
}
end

Expand Down Expand Up @@ -239,7 +239,7 @@
{
a: 1,
b: [{
c: Faraday::UploadIO.new(__FILE__, 'text/x-ruby'),
c: Faraday::FilePart.new(__FILE__, 'text/x-ruby'),
d: 2
}]
}
Expand Down Expand Up @@ -284,8 +284,8 @@
{
a: 1,
b: [
Faraday::UploadIO.new(io, 'application/pdf'),
Faraday::UploadIO.new(io, 'application/pdf')
Faraday::FilePart.new(io, 'application/pdf'),
Faraday::FilePart.new(io, 'application/pdf')
]
}
end
Expand Down
2 changes: 1 addition & 1 deletion spec/faraday/request/retry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@

it 'UploadIO: should rewind files on retry' do
io = StringIO.new('Test data')
upload_io = Faraday::UploadIO.new(io, 'application/octet/stream')
upload_io = Faraday::FilePart.new(io, 'application/octet/stream')

rewound = 0
rewind = -> { rewound += 1 }
Expand Down