Return 406 instead of 500 for statistics.json

Fixes #7406
This commit is contained in:
Steffen van Bergerem 2017-03-30 17:38:11 +02:00
parent 9a76cf7d3b
commit c94bac3cf9
No known key found for this signature in database
GPG key ID: 315C9787D548DC6B
2 changed files with 9 additions and 1 deletions

View file

@ -13,6 +13,9 @@ class NodeInfoController < ApplicationController
end
def statistics
@statistics = NodeInfoPresenter.new("1.0")
respond_to do |format|
format.json { head :not_acceptable }
format.all { @statistics = NodeInfoPresenter.new("1.0") }
end
end
end

View file

@ -51,6 +51,11 @@ describe NodeInfoController do
end
describe "#statistics" do
it "returns a 406 for json format" do
get :statistics, format: "json"
expect(response.code).to eq("406")
end
it "responds to html" do
get :statistics, format: "html"
expect(response.code).to eq("200")