Skip to content

Commit

Permalink
Alias health_check so it responds to health-check
Browse files Browse the repository at this point in the history
The AWS health check endpoint has been configured to look for the route
`health-check` instead of `health_check`.

Rather than asking them to reconfigure it, we will accept that both
versions (with dash and with underscore) are common, and provide an
alias for the route, so that it responds to both requests.
  • Loading branch information
CristinaRO committed Nov 30, 2023
1 parent 8c36214 commit 58211c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

scope module: "public" do
get "health_check" => "base#health_check"
match "health-check" => "base#health_check", via: :get
root to: "visitors#index"
end

Expand Down
5 changes: 5 additions & 0 deletions spec/requests/health_check_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
end
end

it "responds to health-check" do
get "/health-check", headers: {"CONTENT_TYPE" => "application/json", "ACCEPT" => "application/json"}
expect(response).to have_http_status(:ok)
end

context "when enqueued is 20" do
it "returns the correct size" do
stats_double = double(Sidekiq::Stats, enqueued: 20, retry_size: 0)
Expand Down

0 comments on commit 58211c2

Please sign in to comment.