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

Upgrading the Faraday gem from version 1.0.0 to 2.0 #1

Merged
merged 6 commits into from
May 2, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@
# THE SOFTWARE.
#--------------------------------------------------------------------------
source "https://rubygems.org" do
gem "faraday", "~> 1.0", :require => false
gem "faraday_middleware", "~> 1.0.0.rc1", :require => false
gem "faraday", "~> 2.0", :require => false
gem "faraday-follow_redirects", "~> 0.3.0", :require => false
gem "faraday-net_http_persistent", "~> 2.0", :require => false
gem "net-http-persistent", "~> 4.0", :require => false
gem "nokogiri", "~> 1", ">= 1.10.8", :require => false
gem "adal", "~> 1.0", :require => false
Expand Down
5 changes: 3 additions & 2 deletions common/azure-storage-common.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ Gem::Specification.new do |s|

s.required_ruby_version = ">= 2.3.0"

s.add_runtime_dependency('faraday', '~> 1.0')
s.add_runtime_dependency('faraday_middleware', "~> 1.0", ">= 1.0.0.rc1")
s.add_runtime_dependency('faraday', '~> 2.0')
s.add_runtime_dependency('faraday-follow_redirects','~> 0.3.0')
s.add_runtime_dependency('faraday-net_http_persistent', '~> 2.0')
s.add_runtime_dependency("net-http-persistent", '~> 4.0')
s.add_runtime_dependency("nokogiri", "~> 1", ">= 1.10.8")
s.add_development_dependency("dotenv", "~> 2.0")
Expand Down
3 changes: 2 additions & 1 deletion common/lib/azure/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
require 'rubygems'
require 'nokogiri'
require 'faraday'
require 'faraday_middleware'
require 'faraday/follow_redirects'
require 'faraday/net_http_persistent'

module Azure
module Core
Expand Down
2 changes: 1 addition & 1 deletion common/lib/azure/storage/common/autoload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
require "openssl"
require "uri"
require "faraday"
require "faraday_middleware"
require 'faraday/follow_redirects'

require "azure/storage/common/core/autoload"
require "azure/storage/common/default"
Expand Down
2 changes: 1 addition & 1 deletion common/lib/azure/storage/common/client_options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def is_base64_encoded
def is_url
Proc.new do |i|
i = "http://" + i unless i =~ /\Ahttps?:\/\//
i =~ URI.regexp(["http", "https"])
i =~ URI::DEFAULT_PARSER.make_regexp(["http", "https"])
end
end

Expand Down
2 changes: 1 addition & 1 deletion common/lib/azure/storage/common/core/http_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def build_http(uri)
URI::parse(ENV["HTTPS_PROXY"])
end || nil
Faraday.new(uri, ssl: ssl_options, proxy: proxy_options) do |conn|
conn.use FaradayMiddleware::FollowRedirects
conn.response :follow_redirects #use Faraday::FollowRedirects::Middleware
conn.adapter :net_http_persistent, pool_size: 5 do |http|
# yields Net::HTTP::Persistent
http.idle_timeout = 100
Expand Down
4 changes: 2 additions & 2 deletions common/lib/azure/storage/common/service/storage_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ class << self

# Registers the callback when sending the request
# The headers in the request can be viewed or changed in the code block
def register_request_callback
@request_callback = Proc.new
def register_request_callback(&block)
@request_callback = block
end

# Get the request location.
Expand Down
2 changes: 1 addition & 1 deletion table/lib/azure/storage/table/table_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ def encodeODataUriValue(value)
value = value.gsub("'", "''")

# Encode the special URL characters
value = URI.escape(value)
value = URI.encode_www_form_component(value)

value
end
Expand Down