Skip to content

Commit

Permalink
Feature/Implement Rack middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
bestwebua committed Mar 23, 2024
1 parent 7065fc6 commit 0803e59
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions lib/on_strum/healthcheck/rack_middleware.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# frozen_string_literal: true

module OnStrum
module Healthcheck
class RackMiddleware
def initialize(app)
@app = app
end

def call(env)
request = build_request(env)
return [503, { 'Content-Type' => 'application/json' },[{ olo: :molo }.to_json]] if request.path.eql?('/healthcheck')

app.call(env)
end

private

attr_reader :app

def build_request(env)
::Rack::Request.new(env)
end
end
end
end

0 comments on commit 0803e59

Please sign in to comment.