Commit 100120e7 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch '209910-wiki-respond-not_acceptable' into 'master'

Wiki controller should not crash on receiving a non-html request

See merge request gitlab-org/gitlab!37466
parents 8f96c3bd 7aca6dfd
......@@ -8,6 +8,8 @@ module WikiActions
extend ActiveSupport::Concern
included do
before_action { respond_to :html }
before_action :authorize_read_wiki!
before_action :authorize_create_wiki!, only: [:edit, :create]
before_action :authorize_admin_wiki!, only: :destroy
......
---
title: Wiki controller should not crash with non-html format
merge_request: 37466
author:
type: fixed
......@@ -61,6 +61,14 @@ RSpec.shared_examples 'wiki controller actions' do
expect(assigns(:sidebar_wiki_entries)).to be_nil
expect(assigns(:sidebar_limited)).to be_nil
end
context 'when the request is of non-html format' do
it 'returns a 404 error' do
get :pages, params: routing_params.merge(format: 'json')
expect(response).to have_gitlab_http_status(:not_found)
end
end
end
describe 'GET #history' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment