summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-03-21 09:37:18 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-03-21 09:37:18 +0200
commitfb919a631c16f0046c5599a9e9e9fa38ff4a699a (patch)
tree21845ddbba3bf17f1016be258f876ea88a03b1b1
parent60c3e841ce4f0bb29917bff6318167f5b417c426 (diff)
parentac35ee37071836e55543a58e6bdf6a5490e963d2 (diff)
downloadgitlab-ce-fb919a631c16f0046c5599a9e9e9fa38ff4a699a.tar.gz
Merge branch 'dmedvinsky-username-keys-content-type'
-rw-r--r--CHANGELOG1
-rw-r--r--app/controllers/profiles/keys_controller.rb2
-rw-r--r--spec/controllers/profile_keys_controller_spec.rb10
3 files changed, 12 insertions, 1 deletions
diff --git a/CHANGELOG b/CHANGELOG
index f2124408b42..441f36a5bde 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -30,6 +30,7 @@ v 6.7.0
- Requires at least 2 unicorn workers
- Requires gitlab-shell v1.9+
- Replaced gemoji(due to closed licencing problem) with Phantom Open Emoji library(combined SIL Open Font License, MIT License and the CC 3.0 License)
+ - Fix `/:username.keys` response content type (Dmitry Medvinsky)
v 6.6.5
- Added option to remove issue assignee on project issue page and issue edit page (Jason Blanchard)
diff --git a/app/controllers/profiles/keys_controller.rb b/app/controllers/profiles/keys_controller.rb
index b4f14e649e2..6713cd7c8c7 100644
--- a/app/controllers/profiles/keys_controller.rb
+++ b/app/controllers/profiles/keys_controller.rb
@@ -41,7 +41,7 @@ class Profiles::KeysController < ApplicationController
begin
user = User.find_by_username(params[:username])
if user.present?
- render text: user.all_ssh_keys.join("\n")
+ render text: user.all_ssh_keys.join("\n"), content_type: "text/plain"
else
render_404 and return
end
diff --git a/spec/controllers/profile_keys_controller_spec.rb b/spec/controllers/profile_keys_controller_spec.rb
index 121012d5d49..593d3e9eb56 100644
--- a/spec/controllers/profile_keys_controller_spec.rb
+++ b/spec/controllers/profile_keys_controller_spec.rb
@@ -24,6 +24,11 @@ describe Profiles::KeysController do
expect(response.body).to eq("")
end
+
+ it "should respond with text/plain content type" do
+ get :get_keys, username: user.username
+ expect(response.content_type).to eq("text/plain")
+ end
end
describe "user with keys" do
@@ -44,6 +49,11 @@ describe Profiles::KeysController do
expect(response.body).not_to eq("")
expect(response.body).to eq(user.all_ssh_keys.join("\n"))
end
+
+ it "should respond with text/plain content type" do
+ get :get_keys, username: user.username
+ expect(response.content_type).to eq("text/plain")
+ end
end
end
end