Class: TentD::API::Followings::ProxyRequest
- Inherits:
-
Middleware
- Object
- Middleware
- TentD::API::Followings::ProxyRequest
- Defined in:
- lib/tentd/api/followings.rb
Instance Method Summary collapse
Methods inherited from Middleware
Methods included from Authorizable
#authorize_env!, #authorize_env?
Constructor Details
This class inherits a constructor from TentD::API::Middleware
Instance Method Details
#action(env) ⇒ Object
139 140 141 142 143 144 145 146 147 148 |
# File 'lib/tentd/api/followings.rb', line 139 def action(env) following = env.following client = TentClient.new(following.core_profile.servers.first, following.auth_details.merge(:skip_serialization => true, :faraday_adapter => TentD.faraday_adapter)) env.params.delete(:following_id) path = env.params.delete(:proxy_path) res = client.http.get(path, env.params, whitelisted_headers(env)) [res.status, res.headers, [res.body]] end |
#whitelisted_headers(env) ⇒ Object
150 151 152 153 154 |
# File 'lib/tentd/api/followings.rb', line 150 def whitelisted_headers(env) %w(Accept If-Modified-Since).inject({}) do |h,k| h[k] = env['HTTP_' + k.gsub('-', '_').upcase]; h end end |