mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-27 10:14:17 +08:00
19 lines
492 B
Ruby
19 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
|