scinote-web/app/middlewares/wopi_method_override.rb
2018-05-21 15:19:11 +02:00

20 lines
492 B
Ruby

# When WOPI performs calls onto SciNote WOPI subdomain REST endpoints
# Rack::MethodOverride MUST be omitted because it crashes the requests
# due to trying to parse body of the requests
class WopiMethodOverride
def initialize(app)
@app = app
end
def call(env)
app = @app
unless WopiSubdomain.matches?(ActionDispatch::Request.new(env))
# Use the wrapped Rack::MethodOverride middleware
app = Rack::MethodOverride.new(@app)
end
app.call(env)
end
end