class Lucid::Shopify::Session::Middleware
Public Class Methods
new(app)
click to toggle source
@param app [#call]
# File lib/lucid/shopify/session/middleware.rb, line 11 def initialize(app) @app = app end
Public Instance Methods
call(env)
click to toggle source
@param env [Hash]
@param [Array<Integer, Hash{String => String}, Array<String>]
# File lib/lucid/shopify/session/middleware.rb, line 18 def call(env) Authorise.new.(env) @app.call(env) rescue UnauthorisedError Rack::Response.new do |res| res.status = 401 res.set_header('Content-Type', 'application/json') res.write({ error: 'Invalid session token', }.to_json) end.to_a end