Skip to content

Commit ae924da

Browse files
Merge pull request #49 from datacite/change-up-heartbeat
Refactor heartbeat endpoint to use text/plain instead of json
2 parents 04e6c90 + 33d8ff2 commit ae924da

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

app/controllers/heartbeat_controller.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
class HeartbeatController < ApplicationController
44
def index
5-
message = { data: { healthy: true } }
6-
7-
render(json: message)
5+
render(
6+
plain: "OK",
7+
status: :ok,
8+
content_type: "text/plain",
9+
)
810
end
911
end

spec/requests/heartbeat_controller_spec.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,13 @@
1313
it "returns json" do
1414
get "/heartbeat"
1515

16-
expect(response.content_type).to(eq("application/json; charset=utf-8"))
16+
expect(response.content_type).to(eq("text/plain; charset=utf-8"))
1717
end
1818

1919
it "returns the expected data" do
2020
get "/heartbeat"
2121

22-
expected = { data: { healthy: true } }
23-
24-
expect(JSON.parse(response.body, symbolize_names: true)).to(eq(expected))
22+
expect(response.body).to(eq("OK"))
2523
end
2624
end
2725
end

0 commit comments

Comments
 (0)