Sha256: 65aeb0a9d2aeb99c818b66637dbd4306298b434bdeafbceeefb4ed565d7cb6bd
Contents?: true
Size: 611 Bytes
Versions: 5
Compression:
Stored size: 611 Bytes
Contents
# Captures surrogate keys headers and collects them for passing to the client. module FlexCommerceApi module JsonApiClientExtension class CaptureSurrogateKeysMiddleware < ::Faraday::Middleware def call(environment) @app.call(environment).on_complete do |env| surrogate_keys = env.response_headers['external-surrogate-key'].split(' ') if env.response_headers['external-surrogate-key'] if surrogate_keys && Thread.current[:shift_surrogate_keys] Thread.current[:shift_surrogate_keys].concat(surrogate_keys) end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems