Module: Flexirest::JsonAPIProxy::Headers
Overview
Creating JSON API header
Instance Method Summary collapse
- #headers ⇒ Object
-
#save(headers) ⇒ Object
extend selfmakes this module a single process-wide object, so the headers used while building a request must not be stashed in an ivar here — concurrent requests would overwrite each other's (and leak authentication headers across requests).
Instance Method Details
#headers ⇒ Object
185 186 187 |
# File 'lib/flexirest/json_api_proxy.rb', line 185 def headers Thread.current[:flexirest_jsonapi_headers] end |
#save(headers) ⇒ Object
extend self makes this module a single process-wide object, so the
headers used while building a request must not be stashed in an ivar
here — concurrent requests would overwrite each other's (and leak
authentication headers across requests). Hold them per-thread instead.
179 180 181 182 183 |
# File 'lib/flexirest/json_api_proxy.rb', line 179 def save(headers) # Save headers used in a request for building lazy association # loaders when parsing the response Thread.current[:flexirest_jsonapi_headers] = headers end |