mashape 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/http_client.rb +3 -2
- metadata +2 -2
data/lib/http_client.rb
CHANGED
@@ -49,7 +49,7 @@ module Mashape
|
|
49
49
|
elsif handler.kind_of? Mashape::QueryAuthentication
|
50
50
|
parameters = parameters.merge(handler.handleParams)
|
51
51
|
elsif handler.kind_of? Mashape::OAuth10aAuthentication
|
52
|
-
if handler.handleParams[:access_token] == nil || handler.handleParams[:access_secret] == nil
|
52
|
+
if url.start_with?("/oauth_url") == false && (handler.handleParams[:access_token] == nil || handler.handleParams[:access_secret] == nil)
|
53
53
|
raise Mashape::JsonException.new("Before consuming OAuth endpoint, invoke authorize('access_token','access_secret') with not null values")
|
54
54
|
end
|
55
55
|
# These headers will be processed by the proxy to sign the request
|
@@ -58,11 +58,12 @@ module Mashape
|
|
58
58
|
headers["x-mashape-oauth-accesstoken"] = handler.handleParams[:access_token]
|
59
59
|
headers["x-mashape-oauth-accesssecret"] = handler.handleParams[:access_secret]
|
60
60
|
elsif handler.kind_of? Mashape::OAuth2Authentication
|
61
|
-
if handler.handleParams[:access_token] == nil
|
61
|
+
if url.start_with?("/oauth_url") == false && handler.handleParams[:access_token] == nil
|
62
62
|
raise Mashape::JsonException.new("Before consuming OAuth endpoint, invoke authorize('access_token') with a not null value")
|
63
63
|
end
|
64
64
|
parameters = parameters.merge({"access_token" => handler.handleParams[:access_token]})
|
65
65
|
end
|
66
|
+
|
66
67
|
end
|
67
68
|
|
68
69
|
Mashape::HttpUtils.setRequestHeaders(content_type, response_type, headers)
|