Class: OAuth2::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/ext/oauth2/client.rb

Overview

Monkey patch to correct status handling

Instance Method Summary collapse

Instance Method Details

#old_requestObject



5
# File 'lib/ext/oauth2/client.rb', line 5

alias :old_request :request

#request(verb, url, params = {}, headers = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/ext/oauth2/client.rb', line 6

def request(verb, url, params = {}, headers = {})
  old_request(verb, url, params, headers)
rescue OAuth2::HTTPError => e
  if e.response.status == 302
    url = e.response.headers['location']
    retry
  else
    raise e
  end
end