Issue #57 - rewind body if possible when retrying
This commit is contained in:
parent
c45740b81c
commit
e8e2350612
|
@ -580,7 +580,7 @@ module Google
|
|||
begin
|
||||
logger.debug("Attempting refresh of access token & retry of request")
|
||||
request.authorization.fetch_access_token!
|
||||
result = request.send(connection)
|
||||
result = request.send(connection, true)
|
||||
rescue Signet::AuthorizationError
|
||||
# Ignore since we want the original error
|
||||
end
|
||||
|
|
|
@ -153,10 +153,13 @@ module Google
|
|||
#
|
||||
# @param [Faraday::Connection] connection
|
||||
# the connection to transmit with
|
||||
# @param [TrueValue,FalseValue] is_retry
|
||||
# True if request has been previous sent
|
||||
#
|
||||
# @return [Google::APIClient::Result]
|
||||
# result of API request
|
||||
def send(connection)
|
||||
def send(connection, is_retry = false)
|
||||
self.body.rewind if is_retry && self.body.respond_to?(:rewind)
|
||||
env = self.to_env(connection)
|
||||
logger.debug { "#{self.class} Sending API request #{env[:method]} #{env[:url].to_s} #{env[:request_headers]}" }
|
||||
http_response = connection.app.call(env)
|
||||
|
|
Loading…
Reference in New Issue