Sha256: 22f1c6a8ee060a5ca6ec37c0175d428a244027c4459807ca2dea4c66455f4e67
Contents?: true
Size: 691 Bytes
Versions: 17
Compression:
Stored size: 691 Bytes
Contents
# frozen_string_literal: true module FmRest module Cloud class AuthErrorHandler < Faraday::Middleware def initialize(app, settings) super(app) @settings = settings end def call(env) request_body = env[:body] # After failure env[:body] is set to the response body @app.call(env) rescue APIError::AccountError => e ClarisIdTokenManager.new(@settings).expire_token # Faraday::Request::Authorization will not get a new token if the # Authorization header is already set env.request_headers.delete("Authorization") env[:body] = request_body @app.call(env) end end end end
Version data entries
17 entries across 17 versions & 1 rubygems