Fix #4973: Wiki pages json index returns 404.
Fix regression introduced in 0db20e0ca. Setting `format: false` on the
wiki pages resource disabled format negotiation on all wiki page routes,
not just the show page, which meant /wiki_pages.json no longer worked.
The fix to monkey patch the internal Rails method that parses the file
extension from the URL, and have it ignore everything but the .html,
.json, .js, and .xml extensions. This is really hacky and may break in
future Rails releases.
This commit is contained in:
@@ -31,6 +31,13 @@ class WikiPagesControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_equal(WikiPage.count, response.parsed_body.css("urlset url loc").size)
|
||||
end
|
||||
|
||||
should "render for a JSON response" do
|
||||
get wiki_pages_path(format: :json)
|
||||
|
||||
assert_response :success
|
||||
assert_equal("application/json", response.media_type)
|
||||
end
|
||||
|
||||
should "redirect the legacy title param to the show page" do
|
||||
get wiki_pages_path(title: "tagme")
|
||||
assert_redirected_to wiki_pages_path(search: { title_normalize: "tagme" }, redirect: true)
|
||||
|
||||
Reference in New Issue
Block a user