From cd3eabd71236d2be1430d2dbf23aad91d73aa783 Mon Sep 17 00:00:00 2001
From: Vinnie Okada <vokada@mrvinn.com>
Date: Thu, 16 Oct 2014 22:45:13 -0500
Subject: [PATCH] Use GET instead of POST for Markdown previews

---
 app/assets/javascripts/markdown_area.js.coffee | 2 +-
 config/routes.rb                               | 2 +-
 spec/routing/project_routing_spec.rb           | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/app/assets/javascripts/markdown_area.js.coffee b/app/assets/javascripts/markdown_area.js.coffee
index a4bd4774dc9..0ca7070dc8b 100644
--- a/app/assets/javascripts/markdown_area.js.coffee
+++ b/app/assets/javascripts/markdown_area.js.coffee
@@ -48,7 +48,7 @@ $(document).ready ->
       preview.text "Nothing to preview."
     else
       preview.text "Loading..."
-      $.post($(this).data("url"),
+      $.get($(this).data("url"),
         md_text: mdText
       ).success (previewData) ->
         preview.html previewData
diff --git a/config/routes.rb b/config/routes.rb
index 5dbb238ba6b..3edc78cee33 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -186,7 +186,7 @@ Gitlab::Application.routes.draw do
       post :unarchive
       post :upload_image
       post :toggle_star
-      post :markdown_preview
+      get :markdown_preview
       get :autocomplete_sources
       get :import
       put :retry_import
diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb
index 112082d8890..f1f5ac96a62 100644
--- a/spec/routing/project_routing_spec.rb
+++ b/spec/routing/project_routing_spec.rb
@@ -61,7 +61,7 @@ end
 #                  project GET    /:id(.:format)          projects#show
 #                          PUT    /:id(.:format)          projects#update
 #                          DELETE /:id(.:format)          projects#destroy
-# markdown_preview_project POST   /:id/markdown_preview(.:format) projects#markdown_preview
+# markdown_preview_project GET    /:id/markdown_preview(.:format) projects#markdown_preview
 describe ProjectsController, "routing" do
   it "to #create" do
     post("/projects").should route_to('projects#create')
@@ -96,7 +96,7 @@ describe ProjectsController, "routing" do
   end
 
   it 'to #markdown_preview' do
-    post('/gitlab/gitlabhq/markdown_preview').should(
+    get('/gitlab/gitlabhq/markdown_preview').should(
       route_to('projects#markdown_preview', id: 'gitlab/gitlabhq')
     )
   end
-- 
GitLab