Merge pull request #7407 from svbergerem/statistics-json-500

Return 406 instead of 500 for statistics.json
This commit is contained in:
Benjamin Neff 2017-03-31 01:00:06 +02:00
commit b639385c46
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
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")