Commit fb919a631c16f0046c5599a9e9e9fa38ff4a699a

Authored by Dmitriy Zaporozhets
2 parents 60c3e841 ac35ee37

Merge branch 'dmedvinsky-username-keys-content-type'

@@ -30,6 +30,7 @@ v 6.7.0 @@ -30,6 +30,7 @@ v 6.7.0
30 - Requires at least 2 unicorn workers 30 - Requires at least 2 unicorn workers
31 - Requires gitlab-shell v1.9+ 31 - Requires gitlab-shell v1.9+
32 - 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) 32 - 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)
  33 + - Fix `/:username.keys` response content type (Dmitry Medvinsky)
33 34
34 v 6.6.5 35 v 6.6.5
35 - Added option to remove issue assignee on project issue page and issue edit page (Jason Blanchard) 36 - Added option to remove issue assignee on project issue page and issue edit page (Jason Blanchard)
app/controllers/profiles/keys_controller.rb
@@ -41,7 +41,7 @@ class Profiles::KeysController < ApplicationController @@ -41,7 +41,7 @@ class Profiles::KeysController < ApplicationController
41 begin 41 begin
42 user = User.find_by_username(params[:username]) 42 user = User.find_by_username(params[:username])
43 if user.present? 43 if user.present?
44 - render text: user.all_ssh_keys.join("\n") 44 + render text: user.all_ssh_keys.join("\n"), content_type: "text/plain"
45 else 45 else
46 render_404 and return 46 render_404 and return
47 end 47 end
spec/controllers/profile_keys_controller_spec.rb
@@ -24,6 +24,11 @@ describe Profiles::KeysController do @@ -24,6 +24,11 @@ describe Profiles::KeysController do
24 24
25 expect(response.body).to eq("") 25 expect(response.body).to eq("")
26 end 26 end
  27 +
  28 + it "should respond with text/plain content type" do
  29 + get :get_keys, username: user.username
  30 + expect(response.content_type).to eq("text/plain")
  31 + end
27 end 32 end
28 33
29 describe "user with keys" do 34 describe "user with keys" do
@@ -44,6 +49,11 @@ describe Profiles::KeysController do @@ -44,6 +49,11 @@ describe Profiles::KeysController do
44 expect(response.body).not_to eq("") 49 expect(response.body).not_to eq("")
45 expect(response.body).to eq(user.all_ssh_keys.join("\n")) 50 expect(response.body).to eq(user.all_ssh_keys.join("\n"))
46 end 51 end
  52 +
  53 + it "should respond with text/plain content type" do
  54 + get :get_keys, username: user.username
  55 + expect(response.content_type).to eq("text/plain")
  56 + end
47 end 57 end
48 end 58 end
49 end 59 end