lib/spaceship/client.rb in spaceship-0.31.8 vs lib/spaceship/client.rb in spaceship-0.31.9
- old
+ new
@@ -26,10 +26,12 @@
# The logger in which all requests are logged
# /tmp/spaceship[time]_[pid].log by default
attr_accessor :logger
+ attr_accessor :csrf_tokens
+
# Base class for errors that want to present their message as
# preferred error info for fastlane error handling. See:
# fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb
class BasicPreferredInfoError < StandardError
TITLE = 'The request could not be completed because:'.freeze
@@ -343,15 +345,19 @@
retry
end
raise ex # re-raise the exception
end
+ # memorize the last csrf tokens from responses
+ def csrf_tokens
+ @csrf_tokens || {}
+ end
+
private
def do_login(user, password)
@loggedin = false
- @requested_csrf_token = nil
ret = send_login_request(user, password) # different in subclasses
@loggedin = true
ret
end
@@ -361,14 +367,9 @@
tokens = response.headers.select { |k, v| %w(csrf csrf_ts).include?(k) }
if tokens and !tokens.empty?
@csrf_tokens = tokens
end
end
- end
-
- # memorize the last csrf tokens from responses
- def csrf_tokens
- @csrf_tokens || {}
end
def request(method, url_or_path = nil, params = nil, headers = {}, &block)
headers.merge!(csrf_tokens)
headers['User-Agent'] = USER_AGENT