Sha256: 4da72c2b764f003db542efdf661946373c6185b8c2428b49215cd2efef3ee590
Contents?: true
Size: 450 Bytes
Versions: 5
Compression:
Stored size: 450 Bytes
Contents
require "rack/utils" # Adds preview param to all requests to Flex API. module FlexCommerceApi module JsonApiClientExtension class PreviewedRequestMiddleware < ::Faraday::Middleware def call(env) env.url.tap do |url| parsed_query = Rack::Utils.parse_nested_query url.query parsed_query[:preview] = true url.query = parsed_query.to_param end @app.call(env) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems